pickAddress.gif

全国省市区数据

详情见[https://github.com/uiwjs/province-city-china](https://github.com/uiwjs/province-city-china)
此处使用的数据是[https://github.com/uiwjs/province-city-china/blob/master/dist/level.json](https://github.com/uiwjs/province-city-china/blob/master/dist/level.json)

具体实现

  1. <link rel="stylesheet" href="https://res.wx.qq.com/open/libs/weui/2.3.0/weui.min.css" />
  2. <body>
  3. <div class="item" id="pickAddress">
  4. <div class="item-title">所在地</div>
  5. <div class="item-right">
  6. <div class="right-title">请选择</div>
  7. <div class="item-arr"><img src="../imgs/i_u_more.png" alt="" class="img"></div>
  8. </div>
  9. </div>
  10. </body>
  11. <script src="../js/address.js"></script><!-- 这里是地址数据 -->
  12. <script type="text/javascript" src="https://res.wx.qq.com/open/libs/weuijs/1.2.1/weui.min.js"></script>
  13. <script>
  14. $('#pickAddress').click(function() {
  15. weui.picker(address, {
  16. defaultValue: ["110000", "110000", "110101"],
  17. onChange: function (result) {
  18. console.log(result)
  19. },
  20. onConfirm: function (result) {
  21. console.log(result)
  22. },
  23. id: 'addressSelect'
  24. })
  25. })
  26. </script>