Unverified 提交 9a21b8b6 作者: Liu Ya 提交者: GitHub

fix(form): Improve form error handling

* 自定义组件 Array 的元素可能为 null

* 自定义组件时没有抛出错误
上级 663d13a6
...@@ -212,7 +212,9 @@ export function useFormEvents({ ...@@ -212,7 +212,9 @@ export function useFormEvents({
const values = await validate(); const values = await validate();
const res = handleFormValues(values); const res = handleFormValues(values);
emit('submit', res); emit('submit', res);
} catch (error) {} } catch (error) {
throw new Error(error);
}
} }
return { return {
......
...@@ -35,7 +35,7 @@ export function useFormValues({ ...@@ -35,7 +35,7 @@ export function useFormValues({
if (isObject(value)) { if (isObject(value)) {
value = transformDateFunc(value); value = transformDateFunc(value);
} }
if (isArray(value) && value[0]._isAMomentObject && value[1]._isAMomentObject) { if (isArray(value) && value[0]?._isAMomentObject && value[1]?._isAMomentObject) {
value = value.map((item) => transformDateFunc(item)); value = value.map((item) => transformDateFunc(item));
} }
// Remove spaces // Remove spaces
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论