跳转到内容

Vue 2.0

一次性监听

js
this.unwatch = this.$watch(
  () => this.comptableDatas,
  (val) => {
    if (val && val.length) {
      this.$nextTick(() => {
        this.$refs.basetable.setCurrentRow(val[0])
        this.getCompProps(val[0], 0)
      })

      // 只执行一次,立刻取消监听
      this.unwatch()
    }
  },
  {immediate: true, deep: false}
)

Will Try My Best.