同步一下地区选择器

This commit is contained in:
aixianling
2021-12-30 16:55:43 +08:00
parent 94f289511d
commit dce018eb1c

View File

@@ -14,10 +14,12 @@
<em>选择区域</em>
<div class="selectedArea" v-if="hasSelected">
<p v-for="area in fullArea" :key="area.id" v-text="area.name"/>
<p v-if="selected.type==5" v-text="selected.name"/>
</div>
<div/>
<span v-if="all" v-text="`全国`" @click="selectNode({}, -1)"/>
<span v-for="(area,i) in fullArea" :key="area.id" v-text="area.levelLabel" @click="selectNode(area, i)"/>
<span v-if="all" v-text="``" @click="selectNode({}, -1)"/>
<span v-for="(area,i) in fullArea" :key="area.id" v-text="area.levelLabel"
@click="selectNode(area, i)"/>
</div>
<!--用来作为占位的-->
<div class="fixedPlaceholder">
@@ -34,7 +36,7 @@
</div>
<div class="bottomBtns">
<div @click="closePopup">取消</div>
<div class="primary fill" @click="handleSelect(currentArea)">确定</div>
<div class="primary fill" @click="handleSelect">确定</div>
</div>
</ai-search-popup>
</section>
@@ -86,7 +88,8 @@ export default {
fullArea: [],
index: '',
list: [],
levelLabels: ["省", "市", "县/区", "镇/街道", "村/社区"]
levelLabels: ["省", "市", "县/区", "镇/街道", "村/社区"],
selected: {}
}
},
watch: {
@@ -133,9 +136,9 @@ export default {
}
})
},
handleSelect(op) {
this.$emit('select', op)
this.$emit('update:name', this.currentArea.name)
handleSelect() {
this.$emit('select', this.index)
this.$emit('update:name', this.selected.name)
this.closePopup()
},
getChild(op) {
@@ -144,6 +147,7 @@ export default {
this.fullArea.push(op)
this.getChildAreas(op.id)
}
this.selected = op
this.index = op.id
}
},
@@ -222,6 +226,9 @@ export default {
display: flex;
align-items: center;
width: fit-content;
max-width: calc(100vw - 128px);
overflow: hidden;
text-overflow: ellipsis;
padding: 0 32px;
height: 80px;
background: #ECF2FF;
@@ -231,6 +238,7 @@ export default {
font-weight: 500;
color: #4181FF !important;
margin: 16px 0 32px;
white-space: nowrap;
}
.fixedTop {