未验证 提交 b90d3572 编写于 作者: ufo025174's avatar ufo025174 提交者: GitHub

fix(AppendForm): 修复 批量添加表单配置 按钮点击事件未使用批量方法 问题; 表单排版改用baseColProps一次配置,减少重复代码 (#2504)

* fix(AppendForm): 修复 批量添加表单配置 按钮点击事件未使用批量方法 问题

* perf(AppendForm): 表单排版改用baseColProps一次配置,减少重复代码
Co-authored-by: N苗大 <caoshengmiao@hypergryph.com>
上级 16574395
......@@ -4,7 +4,9 @@
<BasicForm @register="register" @submit="handleSubmit">
<template #add="{ field }">
<Button v-if="Number(field) === 0" @click="add">+</Button>
<Button class="ml-2" v-if="Number(field) === 0" @click="add">批量添加表单配置</Button>
<Button class="ml-2" v-if="Number(field) === 0" @click="batchAdd">
批量添加表单配置
</Button>
<Button v-if="field > 0" @click="del(field)">-</Button>
</template>
</BasicForm>
......@@ -28,32 +30,24 @@
field: 'field0a',
component: 'Input',
label: '字段0',
colProps: {
span: 8,
},
required: true,
},
{
field: 'field0b',
component: 'Input',
label: '字段0',
colProps: {
span: 8,
},
required: true,
},
{
field: '0',
component: 'Input',
label: ' ',
colProps: {
span: 8,
},
slot: 'add',
},
],
labelWidth: 100,
actionColOptions: { span: 24 },
baseColProps: { span: 8 },
});
async function handleSubmit() {
......@@ -73,9 +67,6 @@
field: `field${n.value}a`,
component: 'Input',
label: '字段' + n.value,
colProps: {
span: 8,
},
required: true,
},
'',
......@@ -85,9 +76,6 @@
field: `field${n.value}b`,
component: 'Input',
label: '字段' + n.value,
colProps: {
span: 8,
},
required: true,
},
'',
......@@ -98,9 +86,6 @@
field: `${n.value}`,
component: 'Input',
label: ' ',
colProps: {
span: 8,
},
slot: 'add',
},
'',
......@@ -117,27 +102,18 @@
field: `field${n.value}a`,
component: 'Input',
label: '字段' + n.value,
colProps: {
span: 8,
},
required: true,
},
{
field: `field${n.value}b`,
component: 'Input',
label: '字段' + n.value,
colProps: {
span: 8,
},
required: true,
},
{
field: `${n.value}`,
component: 'Input',
label: ' ',
colProps: {
span: 8,
},
slot: 'add',
},
],
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册