- 发布上线后获取不到数据?
在我的微信开发者工具上面使用真机预览,是没有问题的,但是预览上面不行,刚刚加了代码 // 打开调试 wx.setEnableDebug({ enableDebug: true }) y预览上面有数据了,这是为什么啊
2021-04-23 - 对象型数组添加字段?
$api.request('接口', 'POST', 参数, res => { res.content.forEach(item => { item.imageUrl = this.data.imgUrl + JSON.parse(JSON.parse(item.content).icon)[0] $api.request('接口','GET',参数,resp=>{ item.shoopName= resp.data.name }) }) this.setData({ orderList:res.content }) console.log(this.data.orderList) }) 通过接口获取到想要的数组res.content,向res.content数组里面每一个对象添加一个shoopName字段和imageUrl字段,然后赋值给orderList, 最后在wxml中遍历orderList,imageUrl字段显示成功,但是shoopName字段没成功。这是为什么?求解!
2021-03-31 - 对象型数组添加字段?
Page({ data: { arr:[{id:1,name:"张三",num:10},{id:2,name:"李四",num:5},{id:3,name:"王二",num:8},{id:4,name:"麻子",num:6}] }, onLoad: function () { arr.map(item=>{ item.price = 11 }) }, }) console.log(arr) //[{id:1,name:"张三",num:10,price:5},{id:2,name:"李四",num:5,price:8},{id:3,name:"王二",num:8,price:10},{id:4,name:"麻子",num:6,price:10}] {{item.num}}--{{item.price}} //只显示name,并没有price [图片]https://developers.weixin.qq.com/s/beobSBm97akc
2020-09-24 - 对象型数组添加字段?
let arr = [{id:1,name:"张三",num:10},{id:2,name:"李四",num:5},{id:3,name:"王二",num:8},{id:4,name:"麻子",num:6}] arr.map(item=>{ item.price = "" wx.request({ url:"接口", success(res){ item.price = res.data.data.price } }) }) console.log(arr) //[{id:1,name:"张三",num:10,price:5},{id:2,name:"李四",num:5,price:8},{id:3,name:"王二",num:8,price:10},{id:4,name:"麻子",num:6,price:10}] <view wx:for="{{arr}}" wx:key="index"> <view>{{item.num}}</view> <view>{{item.price}}</view> </view> //只显示name,并没有price [图片]
2020-09-24 - 遍历map赋值?
遍历一个数组 [{name:"名字1"},{name:"名字2"}].map(v=>{ v.id = 1 }) console.log(数组),值是有的,但是wxml出不来,为什么啊?跪求
2020-09-11 - 谁有小程序request的封装啊啊?
跪求!!!
2020-09-11 - 购物车的数量的加减?
点击加减数字变成NaN了怎么? jian(){ let that = this that.number = that.number - 1 * 1 console.log(that.number) }, jia(){ let that = this console.log(that.number) that.setData({ number : that.number + 1 * 1 }) }, [图片]
2020-09-11 - 如何插入文本?
{ detail: "善悦轻阳 " } 如何插入这种富文本啊啊啊
2020-09-10 - 如何获取唯一标识?
[图片]下一步是不是要进行解密才能获得唯一码
2020-09-09 - 微信授权需要token?
wx.login({ success: res => { // 发送 res.code 到后台换取 openId, sessionKey, unionId if(res.code){ //code存在 wx.getUserInfo({ success: function(resp) { // console.log(resp) wx.request({ url: 'http://192.168.40.22:88/applet/user/auth', data: { wid: res.code }, method:"POST", header: { 'content-type': 'application/json' // 默认值 }, success(resp){ console.log(resp) //POST http://192.168.40.22:88/applet/user/auth 401 (Unauthorized) } }) } }) } } })
2020-09-09