Vue接口请求数据赋值给this.data在其他位置获取不到,非响应式
Vue接口请求数据赋值给this.data在其他位置获取不到
axios请求到的数据赋给属性不是响应式的,无法更新。解决方法使用实例方法:vm.$set( target, propertyName/index, value ),向响应式对象中添加一个 property,并确保这个新 property 同样是响应式的,且触发视图更新。它必须用于向响应式对象上添加新 property,因为 Vue 无法探测普通的新增 property (比如 this.myObject.newProperty = ‘hi’)
原创
2020-05-11 22:09:17 ·
3091 阅读 ·
0 评论