示例
setData中
对该数组使用 单引号 就行
k.setData({ 'functions[0].numbers':1 // 更改functions[0]中numbers的值 })完整demo
const db = wx.cloud.database()Page({ /** * 页面的初始数据 */ data: { functions:[ { name:'爱情邮箱', numbers:0, iconpath:'/images/caomei.png', classifier:"封", color:"green", path:"../mailbox/mailbox" }, { name: '愿望清单', numbers: '0', color:"pink", iconpath: '/images/tiantianquan.png', classifier: "个", path:"../ceshi/ceshi", }, ] }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { var k=this k.setData({ 'functions[0].numbers':1 // 更改functions[0]中numbers的值 }) },})更多
获取更多资料、代码,微信公众号:海轰Pro
回复 海轰 即可













