变更
This commit is contained in:
@@ -89,8 +89,14 @@ const _sfc_main = defineComponent({
|
||||
}
|
||||
return rulesArrs;
|
||||
});
|
||||
const filedValue = computed(() => props.prop ? layForm.model[props.prop] : void 0);
|
||||
watch(() => filedValue.value, (val) => validate(), { deep: true });
|
||||
const filedValue = computed(
|
||||
() => props.prop ? layForm.model[props.prop] : void 0
|
||||
);
|
||||
watch(
|
||||
() => filedValue.value,
|
||||
(val) => validate(),
|
||||
{ deep: true }
|
||||
);
|
||||
const errorMsg = ref();
|
||||
const errorStatus = ref(false);
|
||||
const validate = (callback) => {
|
||||
@@ -101,7 +107,11 @@ const _sfc_main = defineComponent({
|
||||
let model = {};
|
||||
let validateMessage = null;
|
||||
if (layForm.useCN) {
|
||||
validateMessage = Object.assign({}, cnValidateMessage, layForm.validateMessage);
|
||||
validateMessage = Object.assign(
|
||||
{},
|
||||
cnValidateMessage,
|
||||
layForm.validateMessage
|
||||
);
|
||||
model[props.label || props.prop] = filedValue.value;
|
||||
} else {
|
||||
layForm.validateMessage && (validateMessage = layForm.validateMessage);
|
||||
@@ -143,12 +153,14 @@ const _sfc_main = defineComponent({
|
||||
expose({ validate, clearValidate });
|
||||
onMounted(() => {
|
||||
if (props.prop) {
|
||||
layForm.addField(reactive({
|
||||
...toRefs(props),
|
||||
$el: formItemRef,
|
||||
validate,
|
||||
clearValidate
|
||||
}));
|
||||
layForm.addField(
|
||||
reactive({
|
||||
...toRefs(props),
|
||||
$el: formItemRef,
|
||||
validate,
|
||||
clearValidate
|
||||
})
|
||||
);
|
||||
}
|
||||
});
|
||||
const getMarginLeft = computed(() => {
|
||||
@@ -179,7 +191,9 @@ const _sfc_main = defineComponent({
|
||||
}, [
|
||||
props.prop && unref(isRequired) ? (openBlock(), createElementBlock("span", {
|
||||
key: 0,
|
||||
class: normalizeClass(["layui-required", "layui-icon"].concat((_a = unref(layForm).requiredIcons) != null ? _a : ""))
|
||||
class: normalizeClass(
|
||||
["layui-required", "layui-icon"].concat((_a = unref(layForm).requiredIcons) != null ? _a : "")
|
||||
)
|
||||
}, [
|
||||
renderSlot(_ctx.$slots, "required", {
|
||||
props: { ...props, model: unref(layForm).model }
|
||||
|
||||
Reference in New Issue
Block a user