This commit is contained in:
dap
2025-01-16 17:07:16 +08:00
14 changed files with 109 additions and 65 deletions

View File

@@ -9,10 +9,6 @@ defineOptions({
name: 'FormModelDemo',
});
function onSubmit(values: Record<string, any>) {
message.info(JSON.stringify(values)); // 只会执行一次
}
const [Form, formApi] = useVbenForm({
handleSubmit: onSubmit,
schema: [
@@ -70,6 +66,23 @@ const [Modal, modalApi] = useVbenModal({
},
title: '内嵌表单示例',
});
function onSubmit(values: Record<string, any>) {
message.loading({
content: '正在提交中...',
duration: 0,
key: 'is-form-submitting',
});
modalApi.lock();
setTimeout(() => {
modalApi.close();
message.success({
content: `提交成功:${JSON.stringify(values)}`,
duration: 2,
key: 'is-form-submitting',
});
}, 3000);
}
</script>
<template>
<Modal>

View File

@@ -97,7 +97,7 @@ function openFormModal() {
formModalApi
.setData({
// 表单值
values: { field1: 'abc' },
values: { field1: 'abc', field2: '123' },
})
.open();
}