🐛(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);
}
}

View File

@ -197,9 +197,9 @@ function handleClick(node) {
<template>
<lay-tree
:data="data2"
v-model:checkedKeys="checkedKeys"
:showCheckbox="showCheckbox"
:data="data3"
v-model:checkedKeys="checkedKeys3"
:showCheckbox="showCheckbox"
collapse-transition
>
</lay-tree>
@ -213,7 +213,7 @@ import { ref } from 'vue';
const updateCheckedKeys=()=>{
checkedKeys.value=[4]
}
const data2 = ref([{
const data3 = ref([{
title: '一级1',
id: 1,
field: 'name1',
@ -316,7 +316,8 @@ const data2 = ref([{
{
title: '三级2-1-2',
id: 12,
field: ''
field: '',
disabled: true
}]
},
{
@ -375,7 +376,7 @@ const data2 = ref([{
const updateView=()=>{
data2.value[0].title='更新视图'
}
const checkedKeys = ref([2,3])
const checkedKeys3 = ref([12, 14])
const showCheckbox = ref(true)
</script>

View File

@ -21,6 +21,7 @@
<li>[修复] tree 组件 node 配置 disabled 启用时, @node-click 事件仍触发的问题。</li>
<li>[修复] checkbox 组件 label 属性与 default 插槽不设置, layui-checkbox-label 元素仍存在的问题。</li>
<li>[修复] tree 组件 show-checkbox 为 true 时, 复选框与标题间距过宽的问题。</li>
<li>[修复] table 组件 indentSize 属性, 在加载远程数据时不生效的问题。</li>
<li>[调整] date-picker 组件 laydate-range-hover 前景色与背景色。</li>
</ul>
</li>