perf: formApi added validateAndSubmitForm & filedMapToTime renamed fieldMappingTime (#4842)

* perf: formApi added validateAndSubmitForm & filedMapToTime renamed fieldMappingTime
This commit is contained in:
Vben
2024-11-09 15:00:59 +08:00
committed by GitHub
parent 632081e828
commit 8617d3dd1e
13 changed files with 60 additions and 56 deletions

View File

@@ -16,9 +16,10 @@ const [BaseForm, baseFormApi] = useVbenForm({
class: 'w-full',
},
},
fieldMappingTime: [['rangePicker', ['startTime', 'endTime'], 'YYYY-MM-DD']],
// 提交函数
handleSubmit: onSubmit,
// 垂直布局label和input在不同行值为vertical
// 水平布局label和input在同一行
layout: 'horizontal',

View File

@@ -57,8 +57,8 @@ const [Modal, modalApi] = useVbenModal({
modalApi.close();
},
onConfirm: async () => {
await formApi.submitForm();
modalApi.close();
await formApi.validateAndSubmitForm();
// modalApi.close();
},
onOpenChange(isOpen: boolean) {
if (isOpen) {

View File

@@ -8,7 +8,7 @@ import AutoHeightDemo from './auto-height-demo.vue';
import BaseDemo from './base-demo.vue';
import DragDemo from './drag-demo.vue';
import DynamicDemo from './dynamic-demo.vue';
import FormModalDemo from './form-model-demo.vue';
import FormModalDemo from './form-modal-demo.vue';
import SharedDataDemo from './shared-data-demo.vue';
const [BaseModal, baseModalApi] = useVbenModal({

View File

@@ -21,7 +21,6 @@ interface RowType {
const formOptions: VbenFormProps = {
// 默认展开
collapsed: false,
fieldMapToTime: [['dateRangePicker', ['startTime', 'endTime'], 'YYYY-MM']],
schema: [
{
component: 'Input',
@@ -63,11 +62,6 @@ const formOptions: VbenFormProps = {
fieldName: 'datePicker',
label: 'Date',
},
{
component: 'RangePicker',
fieldName: 'dateRangePicker',
label: 'DateRange',
},
],
// 控制表单是否显示折叠按钮
showCollapseButton: true,