el-tree默认选中并高亮


        
data () {
    return {
 treeData: [],
      defaultTreeKeys: '',
      defaultProps: {
        children: 'children',
        label: 'name'
      },
    }
}


 this.defaultTreeKeys = data[0].children[0].children[0].code
 this.$nextTick(() => {
    this.$refs.myTree.setCurrentKey(this.defaultTreeKeys)
 })

相关