样式预览

Css代码记录
<style lang="scss">
.Regional{
width: 100%;
min-height: 100vh;
background: white;
}
.area-Letter{
display: flex;
width: 690rpx;
margin-left: 30rpx;
// heihgt
.area-ch{
width:622rpx;
.one-letter{
width: 100%;
.letter-title{
width:622rpx;
height:30px;
background:rgba(245,245,245,1);
border-radius:8rpx;
font-size:32rpx;
font-family:PingFangSC-Medium,PingFang SC;
font-weight:500;
color:rgba(0,0,0,0.54);
line-height:60rpx;
padding: 0 20rpx;
box-sizing: border-box;
margin:10px 0;
}
.letter-all{
width:622rpx;
height:50px;
border-bottom: 2rpx solid #F6F6F6;
padding: 0 20rpx;
box-sizing: border-box;
font-size:32rpx;
font-family:PingFangSC-Regular,PingFang SC;
font-weight:400;
color:rgba(0,0,0,0.87);
line-height:100rpx;
}
}
}
.area-first{
margin-top: 20rpx;
width: 77rpx;
.letter-list{
width: 77rpx;
font-size:24rpx;
font-family:PingFangSC-Semibold,PingFang SC;
font-weight:600;
color:rgba(235,118,57,1);
line-height:40rpx;
text-align: center;
height: 40rpx;
}
}
}
.area-list{
width: 100%;
background: white;
.list-top{
display: flex;
width: 690rpx;
margin-left: 30rpx;
padding:40rpx 0;
.top-text{
font-size:28rpx;
font-family:PingFangSC-Medium,PingFang SC;
font-weight:500;
color:rgba(0,0,0,0.38);
line-height:48rpx;
}
.top-icon{
width:48rpx;
height:48rpx;
margin-left: auto;
}
}
.hot_city{
display: flex;
flex-wrap: wrap;
width: 690rpx;
margin-left: 30rpx;
.hot-city-view{
width:140rpx;
height:52rpx;
border:2rpx solid rgba(153,153,153,0.6);
margin-right: 20rpx;
font-size:28rpx;
font-family:PingFangSC-Medium,PingFang SC;
font-weight:500;
color:rgba(0,0,0,0.87);
line-height:52rpx;
text-align: center;
}
}
}
.empty_custom {
height: 100rpx;
width: 100%;
}
.header {
width: 100%;
height: 98rpx;
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
position: fixed;
top: 0;
background: #F6F6F6;
z-index: 1001;
.header-user{
width: 42rpx;
height: 38rpx;
margin: 30rpx;
.header-icon{
width: 42rpx;
height: 38rpx;
}
}
.header-search{
width: 42rpx;
height: 38rpx;
margin: 30rpx;
.header-icon{
width: 42rpx;
height: 38rpx;
}
}
}
js代码记录
<script>
import city_list from '../../static/city_list.json'
export default{
data(){
return{
statusBarHeight:getApp().globalData.statusBarHeight,
hot_list:[
{name:'北京'},{name:'杭州'},{name:'上海'},{name:'深圳'},
],
top:0,
city_list:city_list,
scrollTop:0
}
},
created() {
let that = this
uni.getSystemInfo({
success: function (res) {
let bl = 280 * res.windowWidth / 750
that.top = res.screenHeight - bl
}
});
},
methods:{
jump(e){
if(e<=0){
this.scrollTop = 0
}else{
let top = 0
console.log(this.city_list)
for(let i = 0;i < e;i++){
top = top + 50 * (this.city_list[i].data.length + 1)
}
this.scrollTop = top
}
}
}
}
</script>
html页面代码
<template>
<view class="Regional">
<view class="header" :style="'padding-top:'+statusBarHeight+'px'">
<!-- 此处有两个入口,个人中心以及文章的搜索框 -->
<view class="header-user" @click="toPersonCenter">
<image src="../../static/user.svg" class="header-icon" mode=""></image>
</view>
<view class="header-search" @click="toSearch">
<image src="../../static/search.svg" class="header-icon" mode=""></image>
</view>
</view>
<view class="empty_custom" :style="'padding-top:'+statusBarHeight+'px'">
</view>
<view class="area-list">
<view class="list-top">
<view class="top-text">
热门城市
</view>
<image src="../../static/cha.svg" mode="" class="top-icon"></image>
</view>
<view class="hot_city">
<view class="hot-city-view" v-for="(item,index) in hot_list" :key='index'>
{{item.name}}
</view>
</view>
</view>
<view class="area-Letter" v-if="top" :style="'height:'+top+'px'">
<scroll-view :scroll-top="scrollTop" :style="'height:'+top+'px'" scroll-with-animation scroll-y="true" class="scroll-Y" >
<view class="scroll-view-item area-ch" v-for="(item,index) in city_list" :key='index'>
<view class="one-letter">
<view class="letter-title">
{{item.name}}
</view>
<view class="letter-all" v-for="(item_data,index) in item.data" :key='index'>
{{item_data.name}}
</view>
</view>
</view>
</scroll-view>
<view class="area-first">
<view class="letter-list" @click="jump(-1)">
#
</view>
<view class="letter-list" @click="jump(index)" v-for="(item,index) in city_list" :key='index'>
{{item.name}}
</view>
</view>
</view>
</view>
</template>