默认选中第一个节点
This commit is contained in:
@@ -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 => {
|
||||
|
||||
Reference in New Issue
Block a user