Skip to content

Commit

Permalink
feat: add defineProps errorText
Browse files Browse the repository at this point in the history
  • Loading branch information
97vack authored May 8, 2024
1 parent 9040b68 commit 1bade5f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/use/useFormItemController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export const useFormItemController = (options: GlobalProps.FormItemProps) => {
}),
bindId,
rules: [] as GlobalRules.Rules,
errorText: '',
});

globalDatas.bindId = bindId;
Expand Down Expand Up @@ -63,6 +64,9 @@ export const useFormItemController = (options: GlobalProps.FormItemProps) => {
() => ({
each() {
let shareErrRet = null;
if (isMeaningful(globalDatas.errorText)) {
return globalDatas.errorText;
}
const _rules = formUtil.getRules();
if (isArray(_rules)) {
for (let r of _rules) {
Expand Down Expand Up @@ -136,6 +140,7 @@ export const useFormItemController = (options: GlobalProps.FormItemProps) => {
formUtil.setRules(globalDatas.rules);
},
setError(err: any) {
globalDatas.errorText = err;
formUtil.updateErr(err);
},
setValue(value: any) {
Expand Down

0 comments on commit 1bade5f

Please sign in to comment.