feat(form): formState现在,

This commit is contained in:
roymondchen 2024-12-03 14:52:48 +08:00 committed by roymondchen
parent 9948360435
commit e3f6ef48e6
2 changed files with 7 additions and 1 deletions

View File

@ -31,7 +31,7 @@
import { provide, reactive, ref, shallowRef, toRaw, watch, watchEffect } from 'vue';
import { cloneDeep, isEqual } from 'lodash-es';
import { TMagicForm } from '@tmagic/design';
import { TMagicForm, tMagicMessage, tMagicMessageBox } from '@tmagic/design';
import Container from './containers/Container.vue';
import { getConfig } from './utils/config';
@ -106,6 +106,8 @@ const formState: FormState = reactive<FormState>({
setField: (prop: string, field: any) => fields.set(prop, field),
getField: (prop: string) => fields.get(prop),
deleteField: (prop: string) => fields.delete(prop),
$messageBox: tMagicMessageBox,
$message: tMagicMessage,
post: (options: any) => {
if (requestFuc) {
return requestFuc({

View File

@ -16,6 +16,8 @@
* limitations under the License.
*/
import type { TMagicMessage, TMagicMessageBox } from '@tmagic/design';
export interface ValidateError {
message: string;
field: string;
@ -59,6 +61,8 @@ export type FormState = {
setField: (prop: string, field: any) => void;
getField: (prop: string) => any;
deleteField: (prop: string) => any;
$messageBox: TMagicMessageBox;
$message: TMagicMessage;
[key: string]: any;
};