Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
liyeyun
Project
Project
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
cfld-frontend
liyeyun
Commits
fbb053a3
Commit
fbb053a3
authored
Dec 22, 2023
by
王玉鑫
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 切回首页城市初始化修正
parent
11d22ed2
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
2 deletions
+17
-2
CommonHeader.vue
src/components/common/CommonHeader.vue
+17
-2
No files found.
src/components/common/CommonHeader.vue
View file @
fbb053a3
...
@@ -187,7 +187,9 @@ const userInfo = computed(() => {
...
@@ -187,7 +187,9 @@ const userInfo = computed(() => {
const
showUserCenter
=
ref
<
boolean
>
(
false
);
const
showUserCenter
=
ref
<
boolean
>
(
false
);
const
currentCity
=
ref
<
string
>
(
'全国'
);
const
filterSpace
=
(
name
:
string
)
=>
{
return
name
.
replace
(
/
\s
+/g
,
''
);
};
const
{
getProvinces
}
=
useCity
();
const
{
getProvinces
}
=
useCity
();
...
@@ -236,6 +238,19 @@ const cityList = [
...
@@ -236,6 +238,19 @@ const cityList = [
},
},
];
];
const
currentCity
=
ref
<
string
>
(
''
);
const
initCity
=
()
=>
{
const
name
=
filterSpace
(
searchParamsStore
.
globalProvinceName
);
const
result
=
cityList
.
map
(({
items
})
=>
items
)
.
flat
()
.
find
((
i
)
=>
name
.
indexOf
(
i
)
>
-
1
);
currentCity
.
value
=
result
||
'全国'
;
};
initCity
();
const
dropdown
=
ref
<
DropdownInstance
>
();
const
dropdown
=
ref
<
DropdownInstance
>
();
onMounted
(()
=>
{
onMounted
(()
=>
{
...
@@ -288,7 +303,7 @@ const changeCityStatus = (status: number) => {
...
@@ -288,7 +303,7 @@ const changeCityStatus = (status: number) => {
/** 用于搜索条件的省名 */
/** 用于搜索条件的省名 */
const
cityInFilter
=
computed
(()
=>
{
const
cityInFilter
=
computed
(()
=>
{
return
provinceList
.
find
((
item
)
=>
{
return
provinceList
.
find
((
item
)
=>
{
return
item
.
name
.
replace
(
/
\s
+/g
,
''
).
indexOf
(
currentCity
.
value
)
>
-
1
;
return
filterSpace
(
item
.
name
).
indexOf
(
currentCity
.
value
)
>
-
1
;
});
});
});
});
...
...
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