fix: fix tree cant be chechked
This commit is contained in:
parent
4aa945c68b
commit
6a92e6e0ec
2400
pnpm-lock.yaml
Normal file
2400
pnpm-lock.yaml
Normal file
File diff suppressed because it is too large
Load Diff
@ -4,7 +4,7 @@ export default {
|
||||
};
|
||||
</script>
|
||||
|
||||
<script setup name="LayCheckbox" lang="ts">
|
||||
<script setup lang="ts">
|
||||
import { computed, defineProps, inject } from "vue";
|
||||
import "./index.less";
|
||||
|
||||
|
@ -113,11 +113,12 @@ function handleTitleClick(node: TreeData) {
|
||||
</span>
|
||||
<LayCheckbox
|
||||
v-if="showCheckbox"
|
||||
v-model:checked="node.isChecked.value"
|
||||
:modelValue="node.isChecked.value"
|
||||
:disabled="node.isDisabled.value"
|
||||
skin="primary"
|
||||
label=""
|
||||
@change="
|
||||
({ checked }) => {
|
||||
(checked) => {
|
||||
handleChange(checked, node)
|
||||
}
|
||||
"
|
||||
|
@ -135,6 +135,7 @@ class Tree {
|
||||
setChildrenChecked(checked: boolean, nodes: TreeData[]) {
|
||||
const len = nodes.length
|
||||
for (let i = 0; i < len; i++) {
|
||||
console.log(nodes[i], checked);
|
||||
nodes[i].isChecked.value = checked
|
||||
nodes[i].children &&
|
||||
nodes[i].children.length > 0 &&
|
||||
@ -167,6 +168,7 @@ class Tree {
|
||||
if (node.children) {
|
||||
this.setChildrenChecked(checked, node.children)
|
||||
}
|
||||
console.log(this.getData());
|
||||
}
|
||||
|
||||
getData() {
|
||||
|
@ -29,6 +29,7 @@ export const useTree: UseTree = (props: TreeProps, emit: TreeEmits) => {
|
||||
|
||||
const nodeList = computed(() => {
|
||||
const nodes = tree.getData()
|
||||
console.log(nodes);
|
||||
return nodes
|
||||
})
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user