Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
V
vue-gjjs
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
zhouqian
vue-gjjs
Commits
b7a9f8f2
Commit
b7a9f8f2
authored
Oct 11, 2022
by
潘际乾
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
checkAll之后的错误提示信息定位
parent
c8cf2628
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
16 deletions
+15
-16
index.js
src/utils/index.js
+15
-16
No files found.
src/utils/index.js
View file @
b7a9f8f2
...
...
@@ -160,27 +160,20 @@ export default class Utils {
// 顺序
for
(
let
i
=
0
;
i
<
formFields
.
length
;
i
++
)
{
const
field
=
formFields
[
i
];
for
(
const
key
in
fieldErrors
)
{
if
(
Object
.
hasOwnProperty
.
call
(
fieldErrors
,
key
))
{
if
(
field
.
prop
===
key
)
{
const
fieldError
=
fieldErrors
[
key
];
field
.
validateState
=
'error'
;
field
.
validateMessage
=
fieldError
;
if
(
!
firstErrorItem
)
{
firstErrorItem
=
field
}
break
;
}
const
fieldError
=
fieldErrors
[
field
.
prop
];
if
(
fieldError
)
{
field
.
validateState
=
'error'
;
field
.
validateMessage
=
fieldError
;
if
(
!
firstErrorItem
)
{
firstErrorItem
=
field
}
}
}
}
let
firstErrorTab
=
null
let
firstErrorTab
=
null
,
collapsePanel
=
null
if
(
firstErrorItem
)
{
let
parentVC
=
firstErrorItem
while
(
!
firstErrorTab
)
{
const
tag
=
parentVC
.
$vnode
.
tag
const
tagsArr
=
tag
.
split
(
"-"
)
const
vcName
=
tagsArr
[
tagsArr
.
length
-
1
]
const
vcName
=
parentVC
.
$options
.
componentName
// 没有Tabs的表单
if
(
vcName
===
"ElForm"
)
{
break
;
...
...
@@ -189,12 +182,18 @@ export default class Utils {
firstErrorTab
=
parentVC
break
;
}
if
(
vcName
===
"ElCollapseItem"
)
{
collapsePanel
=
parentVC
;
}
parentVC
=
parentVC
.
$parent
;
}
if
(
firstErrorTab
)
{
const
tabs
=
firstErrorTab
.
$parent
tabs
.
value
=
firstErrorTab
.
name
}
if
(
collapsePanel
&&
collapsePanel
.
collapse
.
activeNames
.
indexOf
(
collapsePanel
.
name
)
<
0
)
{
collapsePanel
.
collapse
.
activeNames
.
push
(
collapsePanel
.
name
)
}
setTimeout
(()
=>
{
// 滚动到指定节点
firstErrorItem
.
$el
.
scrollIntoView
({
...
...
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