### [微信小程序省市联动功能](https://www.prosaas.cn/article/16595) **Published:** 2020-06-24T01:59:34 **Author:** 5201314 **Excerpt:** 最近呢刚好做了一个省市联动的功能,今天看到有人问这个怎么做,我就把我做的放上来共享一下:首先呢,来看看效果,点… 最近呢刚好做了一个省市联动的功能,今天看到有人问这个怎么做,我就把我做的放上来共享一下: 首先呢,来看看效果,点击文字‘点击’,弹出选择窗口,点击取消或者确定(取消、确定按钮在选择框上边,截图有些不清楚),窗口下滑, ![](https://img.php.cn/upload/article/000/000/051/8ea8d6ccb5b8acf7ff49ae452813ed37-0.gif) 做这个我用的是picker-view这个组件,现在来看一看picker-view的属性: ![](https://img.php.cn/upload/article/000/000/051/342a28026969bd631d5a5146a5b7b04b-1.png) 现在开始写wxml的代码,对了,插一句,我这里是把它写成一个模板的,先看看目录结构 ![](https://img.php.cn/upload/article/000/000/051/d26acd523ab72cb7412bd3f62494d087-2.png) 我们先来看看**cascade.wxml**里的代码: 接下来是**cascade.wxss**的代码: .cascade\_box{     font-size:28rpx;     width: 100%;     height: 0;     position: fixed;     bottom: 0;     left: 0; } .cascade\_hei{     width: 100%;     height:732rpx;     background: #000;     opacity: 0.5; } .cascade\_find{     width: 100%;     height: 500rpx;     position: relative;    /\*bottom: 0;     left: 0;\*/     background: #fff; } .quxiao,.queren{     display: block;     position: absolute;     width: 100rpx;     height: 80rpx;     line-height: 80rpx;    /\*background: #00f;\*/     text-align: center;     color: #0f0; } .queren{     right: 0;     top: 0; } .cascade\_header{     height: 80rpx;     width: 100%;     margin-bottom: 20rpx; } 好了这里的模板写好了,接下来是引用,引用就很简单了: 首先是**las.wxml**的引用: 点击   省:{{jieguo.sheng}}   市:{{jieguo.shi}}   区:{{jieguo.qu}}