all
This commit is contained in:
@@ -43,7 +43,9 @@ const _sfc_main = defineComponent({
|
||||
} else if (typeof fields === "string" || Array.isArray(fields) && fields.length > 0) {
|
||||
validateItems = [];
|
||||
const validateFields = !fields ? [] : [].concat(fields);
|
||||
validateFields.forEach((field) => formItemMap[field] && validateItems.push(formItemMap[field]));
|
||||
validateFields.forEach(
|
||||
(field) => formItemMap[field] && validateItems.push(formItemMap[field])
|
||||
);
|
||||
}
|
||||
let errorsArrs = [];
|
||||
validateItems.forEach((filed) => {
|
||||
@@ -70,7 +72,9 @@ const _sfc_main = defineComponent({
|
||||
if (clearFields.length === 0) {
|
||||
formItems.forEach((filed) => filed.clearValidate());
|
||||
} else {
|
||||
clearFields.forEach((field) => formItemMap[field] && formItemMap[field].clearValidate());
|
||||
clearFields.forEach(
|
||||
(field) => formItemMap[field] && formItemMap[field].clearValidate()
|
||||
);
|
||||
}
|
||||
};
|
||||
const reset = function() {
|
||||
@@ -88,13 +92,16 @@ const _sfc_main = defineComponent({
|
||||
formItemMap[item.prop] = item;
|
||||
};
|
||||
expose({ validate, clearValidate, reset });
|
||||
provide("LayForm", reactive({
|
||||
formItems,
|
||||
addField,
|
||||
clearValidate,
|
||||
validate,
|
||||
...toRefs(props)
|
||||
}));
|
||||
provide(
|
||||
"LayForm",
|
||||
reactive({
|
||||
formItems,
|
||||
addField,
|
||||
clearValidate,
|
||||
validate,
|
||||
...toRefs(props)
|
||||
})
|
||||
);
|
||||
return (_ctx, _cache) => {
|
||||
return openBlock(), createElementBlock("form", {
|
||||
class: "layui-form",
|
||||
|
||||
Reference in New Issue
Block a user