📝(component): 编写 table 行内编辑案例
This commit is contained in:
@@ -127,7 +127,13 @@ const isDisabled = computed(() => {
|
||||
><slot>{{ label }}</slot></span
|
||||
>
|
||||
<lay-icon
|
||||
:type="props.isIndeterminate && isChecked ? 'layui-icon-subtraction' : isChecked ? 'layui-icon-ok' : ''"
|
||||
:type="
|
||||
props.isIndeterminate && isChecked
|
||||
? 'layui-icon-subtraction'
|
||||
: isChecked
|
||||
? 'layui-icon-ok'
|
||||
: ''
|
||||
"
|
||||
></lay-icon>
|
||||
</div>
|
||||
</span>
|
||||
|
||||
@@ -84,17 +84,22 @@ const tableSelectedKey: WritableComputedRef<Recordable[]> = computed({
|
||||
|
||||
const isExpand: WritableComputedRef<any> = computed({
|
||||
get() {
|
||||
return tableExpandAll.value ? true : tableExpandKeys.value.includes(props.data[props.id]);
|
||||
return tableExpandAll.value
|
||||
? true
|
||||
: tableExpandKeys.value.includes(props.data[props.id]);
|
||||
},
|
||||
set(val) {
|
||||
let newTableExpandKeys = [...tableExpandKeys.value]
|
||||
if (!val) {
|
||||
newTableExpandKeys.splice(newTableExpandKeys.indexOf(props.data[props.id]), 1);
|
||||
} else {
|
||||
newTableExpandKeys.push(props.data[props.id]);
|
||||
}
|
||||
tableExpandAll.value = false;
|
||||
tableExpandKeys.value = newTableExpandKeys;
|
||||
let newTableExpandKeys = [...tableExpandKeys.value];
|
||||
if (!val) {
|
||||
newTableExpandKeys.splice(
|
||||
newTableExpandKeys.indexOf(props.data[props.id]),
|
||||
1
|
||||
);
|
||||
} else {
|
||||
newTableExpandKeys.push(props.data[props.id]);
|
||||
}
|
||||
tableExpandAll.value = false;
|
||||
tableExpandKeys.value = newTableExpandKeys;
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ const props = withDefaults(defineProps<LayTableProps>(), {
|
||||
cellStyle: "",
|
||||
spanMethod: () => {},
|
||||
defaultExpandAll: false,
|
||||
expandKeys: () => []
|
||||
expandKeys: () => [],
|
||||
});
|
||||
|
||||
const tableId = uuidv4();
|
||||
@@ -305,7 +305,10 @@ const getFixedColumn = () => {
|
||||
hasr.value = true;
|
||||
} else {
|
||||
// @ts-ignore
|
||||
if (tableBody.value?.scrollLeft + tableBody.value?.offsetWidth + 2 > tableBody.value?.scrollWidth) {
|
||||
if (
|
||||
tableBody.value?.scrollLeft + tableBody.value?.offsetWidth + 2 >
|
||||
tableBody.value?.scrollWidth
|
||||
) {
|
||||
hasl.value = true;
|
||||
hasr.value = false;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user