fix(tree): support defaultExpandAll prop
defaultExpandLevel已去除-1的行为定义,由defaultExpandAll代替。
This commit is contained in:
parent
6edca1c19c
commit
3ed2339a6d
|
|
@ -211,12 +211,11 @@
|
|||
});
|
||||
|
||||
onMounted(() => {
|
||||
if (props.defaultExpandLevel === '') return;
|
||||
const level = parseInt(props.defaultExpandLevel);
|
||||
if (level === -1) {
|
||||
expandAll(true);
|
||||
} else if (level > 0) {
|
||||
if (level > 0) {
|
||||
state.expandedKeys = filterByLevel(level);
|
||||
} else if (props.defaultExpandAll) {
|
||||
expandAll(true);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ export const basicProps = {
|
|||
type: [String, Number] as PropType<string | number>,
|
||||
default: '',
|
||||
},
|
||||
defaultExpandAll: propTypes.bool.def(false),
|
||||
|
||||
replaceFields: {
|
||||
type: Object as PropType<ReplaceFields>,
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
title="可勾选,默认全部展开"
|
||||
:checkable="true"
|
||||
class="w-1/3 mx-4"
|
||||
defaultExpandLevel="-1"
|
||||
defaultExpandAll
|
||||
@check="handleCheck"
|
||||
/>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue