如果只要考虑微信小程序的话,直接用 mode = region 就行,要兼容其他端就要自己写了
先开下效果
代码如下
//html
<view @click="showpop>所在地址:{
{citytext}}</view>
<view class="addressPopup-box">
<uni-popup id="addressPopup" ref="addressPopup" :type="'bottom'" @change="change">
<picker-view :value="region" @change="bindChange" @pickstart="onPickstart" @pickend="onPickend">
<picker-view-column class="picker-view2">
<view class="f-center" v-for="(item,index) in citylist" :key="index">{
{item.label}}
</view>
</picker-view-column>
<picker-view-column v-if="citylist[region[0]]" class="picker-view2">
<view class="f-center" v-for="(item,index) in citylist[region[0]].children" :key="index">