eeui plugin install https://github.com/aipaw/eeui-plugin-citypicker
eeui plugin uninstall https://github.com/aipaw/eeui-plugin-citypicker
const citypicker = app.requireModule("eeui/citypicker");
<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('citypicker');
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>