From 870b7c28f115e0dd36ea9f97b1da0f0e058c8328 Mon Sep 17 00:00:00 2001 From: ZhangYong Date: Thu, 23 Oct 2025 14:08:50 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BA=A7=E5=93=81=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E9=87=8D=E7=BD=AE=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/MoneyManage/ProductSelect.vue | 16 +++++++++++++++- src/views/moneyManage/receiveDetail/receiveDetail.vue | 14 ++++++++++---- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/src/components/MoneyManage/ProductSelect.vue b/src/components/MoneyManage/ProductSelect.vue index 234eb33..cd25c82 100644 --- a/src/components/MoneyManage/ProductSelect.vue +++ b/src/components/MoneyManage/ProductSelect.vue @@ -244,17 +244,30 @@ const clickmenu = (index) => { activeIndex.value = activeIndex.value === index ? -1 : index; } +const resetSelect = () => { + selectedValue.value = ''; // 重置选中值 + selectedItem.value = ''; // 重置显示文本 + isOpen.value = false; // 关闭下拉菜单 + coinisOpen.value = false; // 关闭金币产品子菜单 + productisOpen.value = false; // 关闭软件产品子菜单 + activeIndex.value = -1; // 关闭二级菜单 +}; + watch(() => props.modelValue, (newVal) => { selectedItem.value = newVal; + selectedValue.value = newVal; }, { immediate: true }); onMounted(async () => { + console.log('打开组件', props.modelValue); selectedValue.value = props.modelValue; selectedItem.value = selectedValue.value || ''; document.addEventListener('click', handleGlobalClick); // 绑定全局事件 }); onUnmounted(() => { + selectedValue.value = ''; document.removeEventListener('click', handleGlobalClick); // 解绑全局事件 }); +defineExpose({ resetSelect });