VUE Watch 监控不到属性

当属性无法监听到的时候,试试以下写法:

watch: {
    tableData: {
      immediate: true,
      handler(val) {
        this.$nextTick(() => {
          this.tableData.forEach(row => {
            if (this.selectedValue.indexOf(row.ID) >= 0) {
              this.$refs.multipleTable.toggleRowSelection(row, true)
            }
          })
        })
      }
    }
  }

 

posted @ 2022-04-14 21:05  沙漠狼  阅读(161)  评论(0编辑  收藏  举报