当前位置: 代码迷 >> 综合 >> Vue更新数据但是界面不刷新
  详细解决方案

Vue更新数据但是界面不刷新

热度:25   发布时间:2024-01-16 11:53:28.0

Vue更新数据不刷新?

直接改data有时候是不行的,

比如data[0].name='AAA',

数据不是props对象格式

------------------------------------------------------------------------------------------------------------

试试下面这种方式,亲测可用,$set方式才会被监听

this.$set(this.list[num], 'delflag', true)

 

-------------------------------------------------------下列是查问题过程的参考资料-----------------------------------------------------

vue更新数据的示例方法

      const { config } = this/*** 只是这样做是无效* config指向的内存地址没有发生变化* 组件无法侦知数据变化*/this.config.value = 90this.config.lineDash = [10, 4]/*** 使用ES6拓展运算符生成新的props对象* 组件侦知数据变化 自动刷新状态*/this.config = { ...this.config }
  相关解决方案