Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
najiu-admin-template
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
najiu-frontend
najiu-admin-template
Commits
9a21b8b6
Unverified
Commit
9a21b8b6
authored
Apr 12, 2021
by
Liu Ya
Committed by
GitHub
Apr 12, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(form): Improve form error handling
* 自定义组件 Array 的元素可能为 null * 自定义组件时没有抛出错误
parent
663d13a6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
2 deletions
+4
-2
useFormEvents.ts
src/components/Form/src/hooks/useFormEvents.ts
+3
-1
useFormValues.ts
src/components/Form/src/hooks/useFormValues.ts
+1
-1
No files found.
src/components/Form/src/hooks/useFormEvents.ts
View file @
9a21b8b6
...
@@ -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
{
...
...
src/components/Form/src/hooks/useFormValues.ts
View file @
9a21b8b6
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment