小程序
小游戏
企业微信
微信支付
扫描小程序码分享
我后端我写好了,接口也调试好了 就想把从后端取的数据 然后放在basic数组中,小程序其他的页面都在这个test1下面 我把后端取得的数据可以放在test1.js中的basic中吗?其他页面可以取到数据吗?我该怎么写? 求大佬指导!!!!!!!!!!!!
2 个回答
加粗
标红
插入代码
插入链接
插入图片
上传视频
不同页面的话 重新请求数据吧
wx.request({ url: 'test.php', //仅为示例,并非真实的接口地址 data: { x: '', y: '' }, header: { 'content-type': 'application/json' // 默认值 }, success (res) { console.log(res.data) } })
你好,麻烦通过点击下方“反馈信息”按钮,提供出现问题的。
请看文档https://developers.weixin.qq.com/miniprogram/dev/api/network/request/wx.request.html
关注后,可在微信内接收相应的重要提醒。
请使用微信扫描二维码关注 “微信开放社区” 公众号
不同页面的话 重新请求数据吧
wx.request({ url: 'test.php', //仅为示例,并非真实的接口地址 data: { x: '', y: '' }, header: { 'content-type': 'application/json' // 默认值 }, success (res) { console.log(res.data) } })
请看文档https://developers.weixin.qq.com/miniprogram/dev/api/network/request/wx.request.html