🐛(component): table 组件 indentSize 属性, 在加载远程数据时不生效的问题

This commit is contained in:
就眠儀式
2022-10-03 01:34:30 +08:00
parent 78b2189974
commit 85b14ba7e4
6 changed files with 29 additions and 17 deletions

View File

@@ -172,7 +172,7 @@ const renderRowClassName = (data: any, index: number) => {
return props.rowClassName(data, index);
};
const childrenIndentSize = props.currentIndentSize + props.indentSize;
const childrenIndentSize = computed(() => props.currentIndentSize + props.indentSize);
const renderFixedStyle = (column: any, columnIndex: number) => {
if (column.fixed) {

View File

@@ -503,12 +503,12 @@ props.columns.map((value: any) => {
});
const currentIndentSize = ref(0);
const childrenExpandSpace = ref(false);
props.dataSource.map((value: any) => {
if (value[props.childrenColumnName]) {
childrenExpandSpace.value = true;
}
const childrenExpandSpace = computed(() => {
return props.dataSource.find((value: any) => {
if (value[props.childrenColumnName]) {
return true;
}
}) != undefined;
});
/**

View File

@@ -24,7 +24,7 @@ export interface TreeProps {
checkedKeys?: KeysType;
data: OriginalTreeData;
showCheckbox?: boolean;
checkStrictly: boolean;
checkStrictly?: boolean;
edit?: EditType;
collapseTransition?: boolean;
onlyIconControl?: boolean;

View File

@@ -1,6 +1,7 @@
import { OriginalTreeData, StringOrNumber } from "./tree.type";
import { Nullable } from "../../types";
import { Ref, ref } from "vue";
import { check } from "prettier";
type CustomKey = string | number;
type CustomString = (() => string) | string;
@@ -134,11 +135,20 @@ class Tree {
setChildrenChecked(checked: boolean, nodes: TreeData[]) {
const len = nodes.length;
/**
* 判断所有子项, 如果存在选中项, 并且全选, 取消所有选中
*
* 如果存在选中项, 未全部选着, 选中全部
*
* 如果不存在选中项, 选中全部可选
*/
for (let i = 0; i < len; i++) {
nodes[i].isChecked = checked;
if(!nodes[i].isDisabled || (nodes[i].isDisabled && nodes[i].children.length > 0)) {
nodes[i].isChecked = checked;
}
nodes[i].children &&
nodes[i].children.length > 0 &&
this.setChildrenChecked(checked, nodes[i].children);
nodes[i].children.length > 0 &&
this.setChildrenChecked(checked, nodes[i].children);
}
}