You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Aug 18, 2021. It is now read-only.
declare function useForm(modelRef: Props, rulesRef?: Props, options?: {
immediate?: boolean;
deep?: boolean;
validateOnRuleChange?: boolean;
debounce?: DebounceSettings;
}): {
.......
};
function useForm(modelRef, rulesRef, options) {
var initialModel = cloneDeep(modelRef);
var validateInfos = {};
Object.keys(rulesRef).forEach(function (key) {
validateInfos[key] = {
autoLink: false,
required: isRequired(rulesRef[key])
};
});
......
}
rulesRef为非必填参数,但是useForm方法中,却没有判断rulesRef是否为undefined,直接进行Object.keys操作....这样会报错~
目前有解决办法
useForm(modelRef, reactive({}));
rulesRef必须为reactive对象,直接使用空对象会有警告,这是由于
watch(rulesRef, function () {
if (options && options.validateOnRuleChange) {
validate();
}
}, {
deep: true
})
这一段代码导致,所以watch必须是一个reactive对象,
The text was updated successfully, but these errors were encountered: