fix(tree): support defaultExpandAll prop

defaultExpandLevel已去除-1的行为定义,由defaultExpandAll代替。
This commit is contained in:
无木 2021-05-29 23:08:10 +08:00
parent 6edca1c19c
commit 3ed2339a6d
3 changed files with 5 additions and 5 deletions

View File

@ -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);
}
});

View File

@ -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>,

View File

@ -13,7 +13,7 @@
title="可勾选,默认全部展开"
:checkable="true"
class="w-1/3 mx-4"
defaultExpandLevel="-1"
defaultExpandAll
@check="handleCheck"
/>