1.将用到的area.js下载放入小程序utils文件夹中
1 2
2.在用到的页面引入area.js
const area = require('../../utils/area.js')
data: {
areaList: Object.assign({}, area.default),
}
getArea: function(val) {
console.log('getArea-- ',val)
},
showArea: function(val) {
console.log('showArea-- ',val)
},
colseArea: function() {
console.log('colseArea-- ')
},
wxml
<van-popup
show="true"
position="bottom"
custom-style="height: 50%;"
bind:close="onClose"
>
<van-area
area-list="{{ areaList }}"
columns-placeholder="{{ ['请选择', '请选择', '请选择'] }}"
columns-num="3"
title="选择地址"
bind:confirm="getArea"
bind:cancel="colseArea"
bind:change="showArea"
/>
</van-popup>
3
4
网友评论