Compare commits

...

2 Commits

Author SHA1 Message Date
e734ad64f0 代码格式化 2023-02-17 11:35:23 +08:00
0df15d84de add table 行内编辑 2023-02-17 11:34:58 +08:00
7 changed files with 191 additions and 134 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -57,6 +57,8 @@ const props = withDefaults(defineProps<TableRowProps>(), {
const tableExpandAll = ref(props.defaultExpandAll);
const editIndex: any = ref({});
const tableExpandKeys: WritableComputedRef<Recordable[]> = computed({
get() {
return [...props.expandKeys];
@ -564,6 +566,7 @@ const radioProps = props.getRadioProps(props.data, props.index);
renderCellClassName(data, column, index, columnIndex),
column.fixed ? `layui-table-fixed-${column.fixed}` : '',
]"
@click="editIndex[columnIndex] = true"
>
<div
style="display: flex"
@ -603,8 +606,21 @@ const radioProps = props.getRadioProps(props.data, props.index);
>
{{ data[column.key] }}
</lay-tooltip>
<span v-else> {{ data[column.key] }} </span>
<template v-else>
<template v-if="column.edit">
<span v-if="!editIndex[columnIndex]">
{{ data[column.key] }}
</span>
<lay-input
:autofocus="true"
v-model="data[column.key]"
v-else
@keyup.enter="editIndex[columnIndex] = false"
@blur="editIndex[columnIndex] = false"
></lay-input>
</template>
<span v-else> {{ data[column.key] }} </span>
</template>
</div>
</td>
</template>
@ -674,3 +690,9 @@ const radioProps = props.getRadioProps(props.data, props.index);
</template>
</template>
</template>
<style scoped>
.layui-table-cell :deep(.layui-input input) {
padding-left: 0;
}
</style>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long