|
|
@@ -21,23 +21,23 @@
|
|
|
<text
|
|
|
:class="['crumb', currentLevel === 0 ? 'crumb-active' : '']"
|
|
|
@click="jumpToLevel(0)"
|
|
|
- >{{ tempProvince || '省份' }}</text>
|
|
|
+ >{{ getItemName(tempProvince) || '省份' }}</text>
|
|
|
<text v-if="tempProvince" class="crumb-arrow">›</text>
|
|
|
<text
|
|
|
:class="['crumb', currentLevel === 1 ? 'crumb-active' : '']"
|
|
|
@click="jumpToLevel(1)"
|
|
|
- >{{ tempCity || '城市' }}</text>
|
|
|
+ >{{ getItemName(tempCity) || '城市' }}</text>
|
|
|
<text v-if="tempCity" class="crumb-arrow">›</text>
|
|
|
<text
|
|
|
:class="['crumb', currentLevel === 2 ? 'crumb-active' : '']"
|
|
|
@click="jumpToLevel(2)"
|
|
|
- >{{ tempDistrict || '区县' }}</text>
|
|
|
+ >{{ getItemName(tempDistrict) || '区县' }}</text>
|
|
|
<block v-if="effectiveLevels >= 4">
|
|
|
<text v-if="tempDistrict" class="crumb-arrow">›</text>
|
|
|
<text
|
|
|
:class="['crumb', currentLevel === 3 ? 'crumb-active' : '']"
|
|
|
@click="jumpToLevel(3)"
|
|
|
- >{{ tempStreet || '街道' }}</text>
|
|
|
+ >{{ getItemName(tempStreet) || '街道' }}</text>
|
|
|
</block>
|
|
|
</view>
|
|
|
|
|
|
@@ -338,6 +338,15 @@ export default {
|
|
|
|
|
|
getItemName(item) {
|
|
|
if (!item) return ''
|
|
|
+ var lvl = item.level
|
|
|
+ // streets 表每个节点都冗余存了省市区街道字段,且北京/天津的区级节点
|
|
|
+ // province 也填了"北京市",所以必须按 level 取对应层级字段,否则区级列表
|
|
|
+ // 会全部命中 province 显示成"北京市"。
|
|
|
+ if (lvl === 1) return item.province || item.name || ''
|
|
|
+ if (lvl === 2) return item.city || item.name || ''
|
|
|
+ if (lvl === 3) return item.district || item.name || ''
|
|
|
+ if (lvl === 4) return item.street || item.name || ''
|
|
|
+ // 兜底(无 level 字段时保持旧逻辑兼容)
|
|
|
return item.province || item.city || item.district || item.street || item.name || ''
|
|
|
},
|
|
|
|