Merge branch 'dev' into 'master'

uniapp(修复): 修复个人中 心编辑省市区弹出框选择不对应

See merge request jianweie/coreshoppro!48
This commit is contained in:
bob bob
2024-10-20 08:36:09 +00:00

View File

@@ -1,5 +1,6 @@
<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>
<script setup lang="ts">
import { watch, watchEffect, reactive, ref, computed, onMounted } from 'vue';
@@ -52,8 +53,10 @@
watchEffect(() => {
if (props.pickerValue && state.cityList.length > 0) {
console.log('props.pickerValue', props.pickerValue);
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 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])
state.cityVal = [provincesIndex, citysIndex, areasIndex];
state.citys = province.children;
state.areas = province.children[citysIndex].children;
}
});