新增时的数据

change的值有改变,但是视图显示的被选是原来的

出现这个问题是因为绑定了对象(需求显示比较复杂),因为数据层次太多,render函数没有自动更新,需手动强制刷新。 this.$forceUpdate就是重新render。

vue强制更新$forceUpdate()

handleChooseTool(e) {
      this.$forceUpdate()
      this.temp.transportMachine = e.id
    },

调用强制更新方法this.$forceUpdate()会更新视图和数据,触发updated生命周期

Logo

前往低代码交流专区

更多推荐