vuejs 组件 移动端push 没有渲染页面

this.idcards.push(arr) 这个无效

就知道了

vuejs有个跟push相同的方法

console.log(this.list.push.toString())

这个push是个同名方法
并非 native 的 array push
只有用它这个“假”方法才能运行监听函数更新视图

你直接用 Array.prototype.push.apply
这种数组的原生方法就绕过监听去了
视图肯定不会变化
 
所以vue已经对数组操作进行封装,可以使用this.list = this.list.concat(newComing)
posted @ 2017-08-29 18:01  luckylou  阅读(1457)  评论(0编辑  收藏  举报