feat: 自定义矩阵列表长度

- 添加 tableWidth 来设定矩阵列表宽度, 默认110
This commit is contained in:
Huangzhe
2025-03-20 13:49:49 +08:00
parent f0f2ca7b19
commit b35c459770
3 changed files with 14 additions and 24 deletions

View File

@@ -3,14 +3,14 @@
<el-table-column width="140">
<template #header></template>
<template #default="{ row /*, column, $index*/ }">
<el-text truncated>
<el-text truncated :style="{ width: `${tableWidth}px` }">
<contenteditable v-model="row.option" :active="active" @blur="emitValue" />
</el-text>
</template>
</el-table-column>
<el-table-column v-for="(col, colIndex) in cols" :key="col.option" width="100">
<template #header>
<el-text truncated>
<el-text truncated :style="{ width: `${tableWidth}px` }">
<contenteditable
v-if="col.option"
v-model="col.option"
@@ -23,6 +23,7 @@
<template #default="{ /*row, column, */ $index: rowIndex }">
<input
type="text"
style="width: 100%"
:name="`R${rowIndex + 1}`"
:value="getInputValue(rowIndex, colIndex)"
@change="handleMatrixTextChange(rowIndex, colIndex, $event)"
@@ -48,6 +49,7 @@ const element = defineModel<question>('element', {
/* const isPreview = */ defineModel<boolean>('isPreview', { required: false, default: false });
const rows = defineModel<questionOptionType[]>('rows', { required: false, default: () => [] });
const cols = defineModel<questionOptionType[]>('cols', { required: false, default: () => [] });
const tableWidth = defineModel<number>('tableWidth', { required: false, default: 110 });
const emit = defineEmits(['update:matrixAnswer', 'update:rowRecord', 'update:element']);