perf: formApi added validateAndSubmitForm & filedMapToTime renamed fieldMappingTime (#4842)
* perf: formApi added validateAndSubmitForm & filedMapToTime renamed fieldMappingTime
This commit is contained in:
@@ -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',
|
||||
|
@@ -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) {
|
@@ -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({
|
||||
|
@@ -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,
|
||||
|
Reference in New Issue
Block a user