mirror of
http://git.coreshop.cn/jianweie/coreshoppro.git
synced 2025-12-06 17:33:27 +08:00
Merge branch 'dev' into 'master'
uniapp(修复): 修复个人中 心编辑省市区弹出框选择不对应 See merge request jianweie/coreshoppro!48
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<uv-picker ref="cityPicker" :columns="addressList" keyName="label" @change="change" @confirm="confirm" @close="close"> </uv-picker>
|
<uv-picker ref="cityPicker" :columns="addressList" keyName="label" @change="change" @confirm="confirm"
|
||||||
|
@close="close"> </uv-picker>
|
||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { watch, watchEffect, reactive, ref, computed, onMounted } from 'vue';
|
import { watch, watchEffect, reactive, ref, computed, onMounted } from 'vue';
|
||||||
@@ -52,8 +53,10 @@
|
|||||||
watchEffect(() => {
|
watchEffect(() => {
|
||||||
if (props.pickerValue && state.cityList.length > 0) {
|
if (props.pickerValue && state.cityList.length > 0) {
|
||||||
|
|
||||||
|
console.log('props.pickerValue', props.pickerValue);
|
||||||
const cityName = props.pickerValue.split(' ');
|
const cityName = props.pickerValue.split(' ');
|
||||||
|
|
||||||
|
const province = state.cityList.find(x => x.label === cityName[0]);
|
||||||
let provincesIndex : number = state.cityList.findIndex(((item : CityAddressType) => item.label === cityName[0]));
|
let provincesIndex : number = state.cityList.findIndex(((item : CityAddressType) => item.label === cityName[0]));
|
||||||
|
|
||||||
let citysIndex : number = state.cityList[provincesIndex].children.findIndex((item : CityAddressType) => item.label === cityName[1])
|
let citysIndex : number = state.cityList[provincesIndex].children.findIndex((item : CityAddressType) => item.label === cityName[1])
|
||||||
@@ -61,6 +64,8 @@
|
|||||||
let areasIndex : number = state.cityList[provincesIndex].children[citysIndex].children.findIndex((item : CityAddressType) => item.label === cityName[2])
|
let areasIndex : number = state.cityList[provincesIndex].children[citysIndex].children.findIndex((item : CityAddressType) => item.label === cityName[2])
|
||||||
|
|
||||||
state.cityVal = [provincesIndex, citysIndex, areasIndex];
|
state.cityVal = [provincesIndex, citysIndex, areasIndex];
|
||||||
|
state.citys = province.children;
|
||||||
|
state.areas = province.children[citysIndex].children;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user