feat(tree): add transition

This commit is contained in:
落小梅
2022-03-24 16:55:08 +08:00
parent 7b6854629b
commit 20d5093ba5
3 changed files with 9 additions and 6 deletions

View File

@@ -6,13 +6,12 @@ export default {
<script setup lang="ts">
import { StringOrNumber } from "./tree.type";
import { Nullable } from "../type";
import LayIcon from "../icon";
import LayCheckbox from "../checkbox";
import { Ref } from "vue";
import { Tree } from "./tree";
import { Nullable } from "../../types";
import LayTransition from "../transition/index.vue";
type CustomKey = string | number;
type CustomString = (() => string) | string;
@@ -34,6 +33,7 @@ interface TreeNodeProps {
nodeList: TreeData[];
showCheckbox: boolean;
showLine: boolean;
accordion: boolean;
onlyIconControl: boolean;
}
@@ -136,7 +136,7 @@ function handleTitleClick(node: TreeData) {
</span>
</div>
</div>
<transition name="move">
<LayTransition :enable="accordion">
<div
v-if="node.isLeaf.value"
class="layui-tree-pack layui-tree-showLine"
@@ -146,12 +146,13 @@ function handleTitleClick(node: TreeData) {
:node-list="node.children"
:show-checkbox="showCheckbox"
:show-line="showLine"
:accordion="accordion"
:tree="tree"
:only-icon-control="onlyIconControl"
@node-click="recursiveNodeClick"
/>
</div>
</transition>
</LayTransition>
</div>
</template>

View File

@@ -85,6 +85,7 @@ function handleClick(node: TreeData) {
:node-list="nodeList"
:show-checkbox="showCheckbox"
:show-line="showLine"
:accordion="accordion"
:only-icon-control="onlyIconControl"
@node-click="handleClick"
/>