默认选中第一个节点

This commit is contained in:
宋伟佳
2021-09-26 16:58:20 +08:00
parent 4bdc515aa8
commit c4a1137a29
@@ -12,6 +12,8 @@
:data="treeData"
:props="defaultProps"
default-expand-all
:current-node-key="nodeKeyId"
node-key="id"
:filter-node-method="filterNode"
highlight-current
ref="tree"
@@ -166,6 +168,7 @@ export default {
name: 'MechanismManage',
data () {
return {
nodeKeyId:'',
searchForm: {
uname:"",
email:""
@@ -279,8 +282,12 @@ export default {
_this: this,
loading: 'treeLoading'
}, res => {
console.log(res);
this.treeData = res.data
console.log(this.treeData);
this.nodeKeyId = this.treeData[0].id
this.$nextTick(function () {
this.$refs.tree.setCurrentKey(this.nodeKeyId)
})
this.id = res.data[0].id
this.getData()
}, e => {