微信小程序获取各种数据值跟设置数据值。
修改设置data数组中的某个值://小程序接收后台数据若为数组时,下标最好为默认索引数组,从0开始排序
var articleId ='1'//对应数组中的索引值
var thisArticle = "articleList[" + articleId + "].iscollection"
console.log(thisArticle);
that.setData({ //必须加[],
[thisArticle]: ishow
}) //若为索引值为定值:egarticleList[0].iscollection,则直接写,不用加[],必须加""
that.setData({ "egarticleList[0].iscollection": ishow
})
小程序修改本页面data中数组中的某个值。//小程序data中的某个值若为数组时,下标最好为**关联**数组Page({
data: {
teacherInfo:{
rachel1:{
name:"rachel",
decoration: "加拿大人,两年多的线上英语教学经验友善耐心,为人随和。擅长烹饪喜欢影视音乐、跳舞更多",
audioImg: "/ico_play.png",
headImg:"/teacher.jpg",
audioSrc:"/001.mp3",
},
<