省市区三级联动

代码实现效果如图

wxml代码:

<view wx:if="{{showLocation==1}}" class="location-bottom" style="height:{{windowHeight}}">

<view class="init">

<view class="top center">

<text>收货地区</text>

<image class="top-image" src="../Images/delPng.png" bindtap='hideAddr'></image>

</view>

<view class="middle">

<picker-view indicator-style="height: 50px;" style="float:left;width:33%; height: 300rpx;" bindchange='chooseProvince' value="{{provinceValue}}">

<picker-view-column>

<view style="line-height: 50px;font-size:32rpx;" class="center">请选择</view>

<block wx:for="{{provinceList}}" wx:for-item="items" wx:key="{{index}}">

<view style="line-height: 50px;font-size:32rpx;" class="center">{{items.region_name}}</view>

</block>

</picker-view-column>

</picker-view>


 

<picker-view indicator-style="height: 50px;" style="float:left;width:33%; height: 300rpx;" bindchange='chooseCity' value="{{cityValue}}">

<picker-view-column>

<view style="line-height: 50px;font-size:32rpx" class="center">请选择</view>

<block wx:for="{{cityList}}" wx:for-item="items" wx:key="{{index}}">

<view style="line-height: 50px;font-size:32rpx" class="center">{{items.region_name}}</view>

</block>

</picker-view-column>

</picker-view>


 

<picker-view indicator-style="height: 50px;" style="float:left;width:33%; height: 300rpx;" bindchange='chooseDistrict' value="{{districtValue}}">

<picker-view-column>

<view style="line-height: 50px;font-size:32rpx" class="center">请选择</view>

<block wx:for="{{districtList}}" wx:for-item="items" wx:key="{{index}}">

<view style="line-height: 50px;font-size:32rpx" class="center">{{items.region_name}}</view>

</block>

</picker-view-column>

</picker-view>

</view>

<view class="bottom center">

<view class="btn center" bindtap='confirmLocation'>

<text>完成</text>

</view>

</view>

</view>

</view>

 

css代码:

.location-bottom{

width:100%;background: rgba(0, 0, 0, 0.7);position: absolute;top:0;left:0;z-index:99

}

 

.location-bottom .init{

position:absolute;left:0;bottom:0rpx;height:600rpx;background: white;width:100%;

}

 

.location-bottom .init .top{

width:100%;height:150rpx;border-bottom: 2rpx solid lightgray;position:relative;

}

 

.location-bottom .init .top text{

color:rgba(51, 51, 51, 1);font-size: 36rpx;

}

 

.location-bottom .init .top .top-image{

width:25rpx;height:25rpx;position: absolute;top:52rpx;right:52rpx;

}

 

.location-bottom .init .middle{

width:100%;height:300rpx;overflow: hidden;

}

 

.location-bottom .init .bottom{

width:100%;height:150rpx;border-top:2rpx solid lightgray;

}

 

.location-bottom .init .bottom .btn{

width:320rpx;height:72rpx;background: rgba(255, 137, 158, 1);border-radius: 36rpx;

}

 

.location-bottom .init .bottom .btn text{

color:white;font-size:32rpx;

}


js代码:js代码见码云

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

一路追求匠人精神

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值