小程序,省市县

<view class="area">
    <text class="left" space="ensp">联系地址:</text>
    <view class="right">
        <picker mode="region" bindchange="bindRegionChange" value="{{region}}" custom-item="{{customItem}}">
            <input class="right-input" disabled="true" placeholder="省份、城市、区县" value="{{region[0]}},{{region[1]}},{{region[2]}}" placeholder-class="place-holder" />
        </picker>
    </view>
    <view class="arrow">
        <image src="/images/common/right.png" />
    </view>
</view>
/**
 * 页面的初始数据
 */
data: {
  region: ['北京市', '北京市', '东城区'],
  province: '北京市',
  city: '北京市',
  district: '东城区',
  detail: '',
  customItem: ''
},
bindRegionChange: function ({ detail: { value } }) {
  this.setData({
    region: value,
    province: value[0],
    city: value[1],
    district: value[2]
  });
}
posted @ 2020-09-24 14:59  TBHacker  阅读(462)  评论(0编辑  收藏  举报