模块引入
const citypicker = app.requireModule('pmuiCitypicker');
let citypicker = requireModuleJs('pmuiCitypicker');
方法
key | 类型 | Demo | 描述 |
---|---|---|---|
params | dictionary | {key:value} | 离线包页面相关参数 |
实例代码
<template>
<div class="app">
<text class="button" @click="citypicker">选择城市</text>
<text>{{province}} {{city}} {{area}}</text>
</div>
</template>
<style>
.app {
flex: 1;
justify-content: center;
align-items: center;
}
.button {
text-align: center;
margin-top: 20px;
padding-top: 20px;
padding-bottom: 20px;
width: 220px;
color: #ffffff;
background-color: #00B4FF;
}
</style>
<script>
const citypicker = app.requireModule('pmuiCitypicker');
export default {
data() {
return {
province: '浙江省', //省份
city: '杭州', //城市
area: '市辖区', //区县
areaOther: false, //是否加上其它区(可选参数)
}
},
methods: {
citypicker() {
citypicker.select({
province: this.province,
city: this.city,
area: this.area
}, (result) => {
this.province = result.province;
this.city = result.city;
this.area = result.area;
});
}
}
};
</script>