0
点赞
收藏
分享

微信扫一扫

微信小程序开发经验总结

一、下面是微信小程序的一段代码:

changeValue:function(e){
let index = e.target.dataset.index
let newValue = "dataDicList["+index+"].newValue"
this.setData({
[newValue]:e.detail.value
})
console.log(this.data.dataDicList)
}

其中有两个要点:

1.这里的function不能用箭头函数,否则this.setData会报错。原因是箭头函数前后为同一个this,而使用function则前后this不一样,这里要求this不一致。

2.要给data中的数组增加新的属性可按照上述代码操作。

 

二、微信的switchTab不能在url上传参,需用setStorageSync代替。

 

三、若微信小程序的width属性在wxss中修改后无效果,则可以在Button组件上加上内联样式,修改width的值,即可。如:

<Button bindtap="exit" class='exitBtn' style="width:100%">安全退出</Button>

 


举报

相关推荐

0 条评论