强制刷新页面$forceupdate

当嵌套集合数据变动时,页面没有进行实时的刷新,这时候就要使用this.$forceUpdate()进行强制刷新页面的变动

使用方法

testForceUpdate() {
  // 模拟数据变动
  this.list[index].list2.splice(index2, 1);
  // 强制刷新页面
  this.$forceUpdate();
},
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.