提交 3ed2339a 作者: 无木

fix(tree): support defaultExpandAll prop

defaultExpandLevel已去除-1的行为定义,由defaultExpandAll代替。
上级 6edca1c1
......@@ -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"
/>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论