Skip to content

Commit e12af1e

Browse files
authored
Merge pull request #668 from Jimmylxue/optimize/city_sticky
2 parents 37337c6 + b638ef5 commit e12af1e

File tree

1 file changed

+44
-41
lines changed

1 file changed

+44
-41
lines changed

src/page/home/home.vue

+44-41
Original file line numberDiff line numberDiff line change
@@ -55,46 +55,46 @@ export default {
5555
},
5656
5757
mounted(){
58-
// 获取当前城市
59-
cityGuess().then(res => {
60-
this.guessCity = res.name;
61-
this.guessCityid = res.id;
62-
})
63-
64-
//获取热门城市
65-
hotcity().then(res => {
66-
this.hotcity = res;
67-
})
68-
69-
//获取所有城市
70-
groupcity().then(res => {
71-
this.groupcity = res;
72-
})
73-
},
74-
75-
components:{
76-
headTop
77-
},
78-
79-
computed:{
80-
//将获取的数据按照A-Z字母开头排序
81-
sortgroupcity(){
82-
let sortobj = {};
83-
for (let i = 65; i <= 90; i++) {
84-
if (this.groupcity[String.fromCharCode(i)]) {
85-
sortobj[String.fromCharCode(i)] = this.groupcity[String.fromCharCode(i)];
86-
}
87-
}
88-
return sortobj
89-
}
90-
},
91-
92-
methods:{
93-
//点击图标刷新页面
94-
reload(){
95-
window.location.reload();
96-
}
97-
},
58+
// 获取当前城市
59+
cityGuess().then(res => {
60+
this.guessCity = res.name;
61+
this.guessCityid = res.id;
62+
})
63+
64+
//获取热门城市
65+
hotcity().then(res => {
66+
this.hotcity = res;
67+
})
68+
69+
//获取所有城市
70+
groupcity().then(res => {
71+
this.groupcity = res;
72+
})
73+
},
74+
75+
components:{
76+
headTop
77+
},
78+
79+
computed:{
80+
//将获取的数据按照A-Z字母开头排序
81+
sortgroupcity(){
82+
let sortobj = {};
83+
for (let i = 65; i <= 90; i++) {
84+
if (this.groupcity[String.fromCharCode(i)]) {
85+
sortobj[String.fromCharCode(i)] = this.groupcity[String.fromCharCode(i)];
86+
}
87+
}
88+
return sortobj
89+
}
90+
},
91+
92+
methods:{
93+
//点击图标刷新页面
94+
reload(){
95+
window.location.reload();
96+
}
97+
},
9898
}
9999
100100
</script>
@@ -171,8 +171,11 @@ export default {
171171
span{
172172
@include sc(0.475rem, #999);
173173
}
174+
position: sticky;
175+
top: 1.95rem;
176+
background-color: #fff;
174177
}
175-
178+
176179
.letter_classify_li{
177180
margin-bottom: 0.4rem;
178181
background-color: #fff;

0 commit comments

Comments
 (0)