默认选中第一个节点
This commit is contained in:
@@ -12,6 +12,8 @@
|
|||||||
:data="treeData"
|
:data="treeData"
|
||||||
:props="defaultProps"
|
:props="defaultProps"
|
||||||
default-expand-all
|
default-expand-all
|
||||||
|
:current-node-key="nodeKeyId"
|
||||||
|
node-key="id"
|
||||||
:filter-node-method="filterNode"
|
:filter-node-method="filterNode"
|
||||||
highlight-current
|
highlight-current
|
||||||
ref="tree"
|
ref="tree"
|
||||||
@@ -166,6 +168,7 @@ export default {
|
|||||||
name: 'MechanismManage',
|
name: 'MechanismManage',
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
|
nodeKeyId:'',
|
||||||
searchForm: {
|
searchForm: {
|
||||||
uname:"",
|
uname:"",
|
||||||
email:""
|
email:""
|
||||||
@@ -279,8 +282,12 @@ export default {
|
|||||||
_this: this,
|
_this: this,
|
||||||
loading: 'treeLoading'
|
loading: 'treeLoading'
|
||||||
}, res => {
|
}, res => {
|
||||||
console.log(res);
|
|
||||||
this.treeData = res.data
|
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.id = res.data[0].id
|
||||||
this.getData()
|
this.getData()
|
||||||
}, e => {
|
}, e => {
|
||||||
|
|||||||
Reference in New Issue
Block a user