未验证 提交 2423aeab 编写于 作者: W wangxiaoer5200 提交者: GitHub

fix: 修复表单重置某些input类型组件不生效问题,close #1519 (#1526)

Co-authored-by: Nbingguo <bingguo@gaoding.com>
上级 1a431422
......@@ -70,3 +70,5 @@ export function handleInputNumberValue(component?: ComponentType, val?: any) {
* 时间字段
*/
export const dateItemType = genType();
export const defaultValueComponents = ['Input', 'InputPassword', 'InputSearch', 'InputTextArea'];
......@@ -4,7 +4,7 @@ import type { NamePath } from 'ant-design-vue/lib/form/interface';
import { unref, toRaw, nextTick } from 'vue';
import { isArray, isFunction, isObject, isString } from '/@/utils/is';
import { deepMerge } from '/@/utils';
import { dateItemType, handleInputNumberValue } from '../helper';
import { dateItemType, handleInputNumberValue, defaultValueComponents } from '../helper';
import { dateUtil } from '/@/utils/dateUtil';
import { cloneDeep, uniqBy } from 'lodash-es';
import { error } from '/@/utils/log';
......@@ -37,7 +37,9 @@ export function useFormEvents({
if (!formEl) return;
Object.keys(formModel).forEach((key) => {
formModel[key] = defaultValueRef.value[key];
const schema = unref(getSchema).find((item) => item.field === key);
const isInput = schema?.component && defaultValueComponents.includes(schema.component);
formModel[key] = isInput ? defaultValueRef.value[key] || '' : defaultValueRef.value[key];
});
nextTick(() => clearValidate());
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册