Closed guxuerui closed 1 year ago
Development Relevant Information:
在UiTree组件中,使用 defaultExpandedKeys 属性传递树节点的value值,但仍然只能默认展开顶级父节点
defaultExpandedKeys
<ui-tree v-model="selectedValue" :data="treeData" :data-format="dataFormat" :max-level="7" auto-expand-parent :default-expanded-keys="defaultKeys" class="itemColor" @selected="handleTreeSelect" />
const treeData = ref([ { name: 'node1', code: 'org1', children: [ { name: 'node1-1', code: 'org1-1', children: [ { name: 'ode2', code: 'org2', children: [ { name: 'node2-1', code: 'org2-1', }, ], }, ] }, ], }, ])
const selectedValue = ref('')
const defaultKeys = ref(['org1', 'org1-1', 'org2', 'org2-1'])
const dataFormat = ref( { label: 'name', value: 'code' }, )
**这样写并不能展开所有节点,请问是我的`defaultExpandedKeys`传的值不对么?**
Thanks to the @elf-mouse , the problem has been solved!
Development Relevant Information:
Description:
在UiTree组件中,使用
defaultExpandedKeys
属性传递树节点的value值,但仍然只能默认展开顶级父节点Steps To Reproduce:
const selectedValue = ref('')
const defaultKeys = ref(['org1', 'org1-1', 'org2', 'org2-1'])
const dataFormat = ref( { label: 'name', value: 'code' }, )