Commit 31a64223 by luyt

fix:解决省市选择重复的key问题-有些省市的code是一样的

1 parent 45f754c6
...@@ -2,13 +2,13 @@ ...@@ -2,13 +2,13 @@
<div v-if="provinceView"> <div v-if="provinceView">
<el-form ref="provinceForm" :model="provinceForm" :inline="true" class="province"> <el-form ref="provinceForm" :model="provinceForm" :inline="true" class="province">
<el-select size="small" v-model="provinceForm.provinceName" clearable placeholder="选择省份" :style="{ width: defaultWidth }" @clear="selectProvince" class="select-padding"> <el-select size="small" v-model="provinceForm.provinceName" clearable placeholder="选择省份" :style="{ width: defaultWidth }" @clear="selectProvince" class="select-padding">
<el-option v-for="item in AllData" :key="item.adcode" :label="item.name" :value="item.name" @click.native="selectProvince(item)"></el-option> <el-option v-for="(item, index) in AllData" :key="'province' + index" :label="item.name" :value="item.name" @click.native="selectProvince(item)"></el-option>
</el-select> </el-select>
<el-select size="small" v-model="provinceForm.cityName" clearable placeholder="选择市" :style="{ width: defaultWidth }" @clear="selectCity" class="select-padding"> <el-select size="small" v-model="provinceForm.cityName" clearable placeholder="选择市" :style="{ width: defaultWidth }" @clear="selectCity" class="select-padding">
<el-option v-for="item in cityList" :key="item.adcode" :label="item.name" :value="item.name" @click.native="selectCity(item)"></el-option> <el-option v-for="(item, index) in cityList" :key="'city' + index" :label="item.name" :value="item.name" @click.native="selectCity(item)"></el-option>
</el-select> </el-select>
<el-select v-if="subdistrict == 3" size="small" v-model="provinceForm.townName" clearable placeholder="选择区" :style="{ width: defaultWidth }" @clear="selectTown" class="select-padding"> <el-select v-if="subdistrict == 3" size="small" v-model="provinceForm.townName" clearable placeholder="选择区" :style="{ width: defaultWidth }" @clear="selectTown" class="select-padding">
<el-option v-for="item in townList" :key="item.adcode" :label="item.name" :value="item.name" @click.native="selectTown(item)"></el-option> <el-option v-for="(item, index) in townList" :key="'town' + index" :label="item.name" :value="item.name" @click.native="selectTown(item)"></el-option>
</el-select> </el-select>
</el-form> </el-form>
</div> </div>
...@@ -149,8 +149,8 @@ export default { ...@@ -149,8 +149,8 @@ export default {
this.provinceForm.townName = '' this.provinceForm.townName = ''
if (val) { if (val) {
this.cityList = val.districts this.cityList = val.districts
}else{ } else {
val='' val = ''
} }
// 选择省 // 选择省
this.$emit('selectProvince', val) this.$emit('selectProvince', val)
...@@ -160,8 +160,8 @@ export default { ...@@ -160,8 +160,8 @@ export default {
this.provinceForm.townName = '' this.provinceForm.townName = ''
if (val) { if (val) {
this.townList = val.districts this.townList = val.districts
}else{ } else {
val='' val = ''
} }
// 选择市 // 选择市
this.$emit('selectCity', val) this.$emit('selectCity', val)
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!