From 7b65c5e27f79444205c69c7b062f31d528434e27 Mon Sep 17 00:00:00 2001 From: Leo_Ding <2405260743@qq.com> Date: Mon, 13 Oct 2025 16:35:48 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=89=80=E5=9C=A8=E5=8C=BA?= =?UTF-8?q?=E5=9F=9F=E6=95=B0=E6=8D=AE=E5=8A=A0=E8=BD=BD=E6=9C=89=E6=97=B6?= =?UTF-8?q?=E4=B8=8D=E6=98=BE=E7=A4=BA=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/AreaCascader/index.vue | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/components/AreaCascader/index.vue b/src/components/AreaCascader/index.vue index b13f364..d4a4d58 100644 --- a/src/components/AreaCascader/index.vue +++ b/src/components/AreaCascader/index.vue @@ -53,10 +53,19 @@ const emit = defineEmits(['change']); // 本地选项数据(初始为空,异步加载) const options = ref([]); -onMounted(() => { - // 使用 store 中的省份数据 - options.value = dicsStore.provinceOptions -}); +watch( + () => dicsStore.provinceOptions, + (newVal) => { + if (newVal && newVal.length > 0) { + options.value = newVal + } + }, + { immediate: true } // 🔥 关键:组件初始化时也会执行一次 +) +// onMounted(async () => { +// // 使用 store 中的省份数据 +// options.value = await dicsStore.provinceOptions +// }); // 异步加载子节点(市、区)