element el-tree 默认调用点击事件

在项目中遇到需求,点击表格中的某一个数据,跳转到有树组件 的页面,并默认调用一次点击事件

element el-tree 默认调用点击事件

在watch中监听树绑定的数据

watch: {
    dataList(val) {
      if (this.$route.query.source) {
        if (val) {
          this.$nextTick(() => {
            document.querySelector('.el-tree-node__content').click()
            const type = this.$route.query.nologgingType
            if (type === 'index') {
              this.activeName1 = 'five'
            } else if (type === 'zoneIndex') {
              this.activeName1 = 'six'
            } else if (type === 'zoneTable') {
              this.activeName1 = 'seven'
            } else if (type === 'zoneTableSon') {
              this.activeName1 = 'eight'
            } else if (type === 'table') {
              this.activeName1 = 'nine'
            }
          })
        }
      }
    }
  },