3,143
社区成员
发帖
与我相关
我的任务
分享
data: {
List: {
items: [{
"id": "1",
"imgurl": "http://img123",
"title": "标题1",
"body": "aaa"
}, {
"id": "2",
"imgurl": "http://img14",
"title": "标题2",
"body": "详情信息"
}]
}
}
showItem: function (e) {
let id = e.currentTarget.id;
wx.setNavigationBarTitle({
title: this.data.List.items[id].title,//这里是错误的
})
}
我想通过id=2时得到title=“标题2”,有没有除了for循环以外的方法,应该怎么写呢?