赞
踩
npm install element-china-area-data -S
<el-cascader
:options="areaSelectData"
@change="handleChange"
class="full-width"
size="large"
v-model="selectedOptions"
placeholder="请选择您所在的城市"
/>
handleChange(value) {
console.log(value)
var provinceCode = CodeToText[value[0]];
var cityCode = CodeToText[value[1]];
var orgion = CodeToText[value[2]];
console.log(provinceCode)
console.log(cityCode)
console.log(orgion)
this.selectedOptions = [value[0] , value[1], value[2]]
this.form1.HomeAddress = provinceCode + cityCode + orgion
},
将数组给到selectedOptions 就可以在页面上显示选择
使用CodeToText就可以将数字变为各个地区
效果图
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。