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
5fae2b02
Unverified
Commit
5fae2b02
authored
Apr 26, 2021
by
M69W
Committed by
GitHub
Apr 26, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
perf: add Coordinating the selection of provinces and cities (#534)
Co-authored-by:
M69W
<
M69W@M69W
>
parent
3ff70bb5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
97 additions
and
0 deletions
+97
-0
index.vue
src/views/demo/form/index.vue
+97
-0
No files found.
src/views/demo/form/index.vue
View file @
5fae2b02
...
...
@@ -19,6 +19,58 @@
import
{
PageWrapper
}
from
'
/@/components/Page
'
;
import
{
optionsListApi
}
from
'
/@/api/demo/select
'
;
const
provincesOptions
=
[
{
id
:
'
guangdong
'
,
label
:
'
广东省
'
,
value
:
'
1
'
,
key
:
'
1
'
,
},
{
id
:
'
jiangsu
'
,
label
:
'
江苏省
'
,
value
:
'
2
'
,
key
:
'
2
'
,
},
];
const
citiesOptionsData
=
{
guangdong
:
[
{
label
:
'
珠海市
'
,
value
:
'
1
'
,
key
:
'
1
'
,
},
{
label
:
'
深圳市
'
,
value
:
'
2
'
,
key
:
'
2
'
,
},
{
label
:
'
广州市
'
,
value
:
'
3
'
,
key
:
'
3
'
,
},
],
jiangsu
:
[
{
label
:
'
南京市
'
,
value
:
'
1
'
,
key
:
'
1
'
,
},
{
label
:
'
无锡市
'
,
value
:
'
2
'
,
key
:
'
2
'
,
},
{
label
:
'
苏州市
'
,
value
:
'
3
'
,
key
:
'
3
'
,
},
],
};
const
schemas
:
FormSchema
[]
=
[
{
field
:
'
field1
'
,
...
...
@@ -236,6 +288,51 @@
span
:
8
,
},
},
{
field
:
'
province
'
,
component
:
'
Select
'
,
label
:
'
省份
'
,
colProps
:
{
span
:
8
,
},
componentProps
:
({
formModel
,
formActionType
})
=>
{
return
{
options
:
provincesOptions
,
placeholder
:
'
省份与城市联动
'
,
onChange
:
(
e
:
any
)
=>
{
// console.log(e)
let
citiesOptions
=
e
==
1
?
citiesOptionsData
[
provincesOptions
[
0
].
id
]
:
citiesOptionsData
[
provincesOptions
[
1
].
id
];
// console.log(citiesOptions)
if
(
e
===
undefined
)
{
citiesOptions
=
[];
}
formModel
.
city
=
undefined
;
// reset city value
const
{
updateSchema
}
=
formActionType
;
updateSchema
({
field
:
'
city
'
,
componentProps
:
{
options
:
citiesOptions
,
},
});
},
};
},
},
{
field
:
'
city
'
,
component
:
'
Select
'
,
label
:
'
城市
'
,
colProps
:
{
span
:
8
,
},
componentProps
:
{
options
:
[],
// defalut []
placeholder
:
'
省份与城市联动
'
,
},
},
];
export
default
defineComponent
({
...
...
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