欢迎光临,了解微信小程序开发,就上易用通!

小程序之ecshop地址3级联动

发布:2018-04-13 14:58浏览: 来源:网络 作者:cola

picker标签,官方给出的实例:

 

				
  1. <view class="section">
  2. <view class="section__title">地区选择器</view>
  3. <picker bindchange="bindPickerChange" value="{{index}}" range="{{array}}">
  4. <view class="picker">
  5. 当前选择:{{array[index]}}
  6. </view>
  7. </picker>
  8. </view>
 

				
  1. Page({
  2. data: {
  3. array: ['美国', '中国', '巴西', '日本'],
  4. index: 0,
  5. },
  6. bindPickerChange: function(e) {
  7. console.log('picker发送选择改变,携带值为', e.detail.value)
  8. this.setData({
  9. index: e.detail.value
  10. })
  11. },
  12. })

wxml页面:

 

				
  1. <view class="add-list under-line" >
  2.  
  3. <view class="add-lab">收货地址</view>
  4. <view class="add-text">
  5. <picker class="w-3" bindchange="bindPickerProvince" value="{{provinceIndex}}" range="{{province}}" >
  6. <view class="picker">{{province[provinceIndex]}}</view>
  7. </picker>
  8. <picker class="w-3" bindchange="bindPickerCity" value="{{cityIndex}}" range="{{city}}" >
  9. <view class="picker">{{city[cityIndex]}}</view>
  10. </picker>
  11. <picker class="w-3" bindchange="bindPickerDistrict" value="{{districtIndex}}" range="{{district}}" >
  12. <view class="picker">{{district[districtIndex]}}</view>
  13. </picker>
  14. </view>
  15. </view>

js页面:

 

				
  1. var app = getApp()
  2. Page({
  3. data:{
  4. motto: 'jxcat',
  5. serverUrl: app.globalData.ajaxUrl,
  6. baseUrl: app.globalData.baseUrl,





免责声明:本站所有文章和图片均来自用户分享和网络收集,文章和图片版权归原作者及原出处所有,仅供学习与参考,请勿用于商业用途,如果损害了您的权利,请联系网站客服处理。