Skip to content

Commit

Permalink
feat(form): formState现在,
Browse files Browse the repository at this point in the history
  • Loading branch information
roymondchen authored and jia000 committed Dec 9, 2024
1 parent 9948360 commit e3f6ef4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/form/src/Form.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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({
Expand Down
4 changes: 4 additions & 0 deletions packages/form/src/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
* limitations under the License.
*/

import type { TMagicMessage, TMagicMessageBox } from '@tmagic/design';

export interface ValidateError {
message: string;
field: string;
Expand Down Expand Up @@ -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;
};

Expand Down

0 comments on commit e3f6ef4

Please sign in to comment.