<模板> < topView viewInfo =“cardInfo”>< / topView> < bottomView viewInfo =“cardInfo”>< / bottomView><模板><脚本> module.exports = { …
直接使用索引设置项目时,Vue无法检测到更改 ,即 this.itemInfo[0].info = this.viewInfo.attr2 +" point" 的 不是反应 强> 。
this.itemInfo[0].info = this.viewInfo.attr2 +" point"
使用 Vue.set 相反,对于上述:
Vue.set
// create a new item var newItem = Object.assign({}, this.itemInfo[0], { info: this.viewInfo.attr2 +" point" }) // set the new item to the specific index this.$set(this.itemInfo, 0, newItem)
你可以阅读更多相关信息 列出渲染注意事项 :