实现效果:
要使用的属性和方法如下:
node-key: 每个树节点用来作为唯一标识的属性,整棵树应该是唯一的
setCurrentKey:通过 key 设置某个节点的当前选中状态,使用此方法必须设置 node-key 属性
设置方法:
this.$nextTick(() => {
this.$refs.tree.setCurrentKey(this.treeData[0].id) // 默认选中节点第一个
})
//初始时设置即可
实现效果:
要使用的属性和方法如下:
node-key: 每个树节点用来作为唯一标识的属性,整棵树应该是唯一的
setCurrentKey:通过 key 设置某个节点的当前选中状态,使用此方法必须设置 node-key 属性
设置方法:
this.$nextTick(() => {
this.$refs.tree.setCurrentKey(this.treeData[0].id) // 默认选中节点第一个
})
//初始时设置即可