8/1 限制前端输入字数

This commit is contained in:
Zy
2026-08-01 10:11:38 +08:00
parent 2907f9202c
commit ca5f214bac
33 changed files with 271 additions and 253 deletions

View File

@@ -36,8 +36,8 @@
</template>
<div class="question-title-area">
<el-input maxlength="20" show-word-limit v-model="form.title" placeholder="请输入问卷标题" class="title-input" />
<el-input maxlength="200" show-word-limit v-model="form.description" type="textarea" placeholder="请输入问卷描述(选填)" />
<el-input maxlength="20" show-word-limit v-model.trim="form.title" placeholder="请输入问卷标题" class="title-input" />
<el-input maxlength="200" show-word-limit v-model.trim="form.description" type="textarea" placeholder="请输入问卷描述(选填)" />
</div>
<draggable v-model="form.content" group="components" item-key="cid" class="question-list" @add="handleAddQuestion">
@@ -72,16 +72,21 @@
</template>
<el-form style="position: sticky; top: 60px" label-width="80px">
<el-form-item label="题目标题">
<el-input v-model="activeQuestion.title" placeholder="请输入题目标题" />
<el-input maxlength="20" v-model.trim="activeQuestion.title" placeholder="请输入题目标题" />
</el-form-item>
<el-form-item label="是否必填">
<el-switch v-model="activeQuestion.required" />
<el-switch v-model.trim="activeQuestion.required" />
</el-form-item>
<!-- 单选/多选特有属性 -->
<template v-if="activeQuestion.type === 'radio' || activeQuestion.type === 'checkbox'">
<el-divider content-position="left">选项设置</el-divider>
<div v-for="(opt, idx) in activeQuestion.options" :key="idx" class="option-item">
<el-input v-model="opt.label" placeholder="选项内容" style="width: 200px; margin-right: 10px; margin-bottom: 10px" />
<el-input
maxlength="20"
v-model.trim="opt.label"
placeholder="选项内容"
style="width: 200px; margin-right: 10px; margin-bottom: 10px"
/>
<el-button link type="danger" :icon="Delete" @click="activeQuestion.options.splice(idx, 1)"> 删除 </el-button>
</div>
<el-button type="primary" @click="activeQuestion.options.push({ label: '新选项' })"> 添加选项 </el-button>