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