From 3460130e7e75dea8ff29f125e17a198b6ead9238 Mon Sep 17 00:00:00 2001 From: ko1234 Date: Fri, 8 Nov 2024 14:36:27 +0800 Subject: [PATCH] =?UTF-8?q?=E7=B3=BB=E7=B5=B1=E7=9B=A3=E6=8E=A7getData?= =?UTF-8?q?=E5=B8=B6=E5=85=A5buildingStore.selectedBuilding?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/system/System.vue | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/views/system/System.vue b/src/views/system/System.vue index 9809284..3ecaf2a 100644 --- a/src/views/system/System.vue +++ b/src/views/system/System.vue @@ -118,21 +118,30 @@ const updateDataByGas = (gas) => { } watch( - [() => buildingStore.selectedBuilding, () => route.params.sub_system_id], - ([newBuilding, newRoute], [oldBuilding, oldRoute]) => { - if (newBuilding && newRoute && newRoute !== oldRoute) { + () => buildingStore.selectedBuilding, + (newBuilding) => { + if (Boolean(newBuilding)) { getData(); } }, { + immediate: true, deep: true, } ); +watch( + () => route.params.sub_system_id, + (newRoute, oldRoute) => { + if (buildingStore.selectedBuilding && newRoute !== oldRoute) { + getData(); + } + } +); + onMounted(() => { getFloors(); getCompany(); - getData(); }); const currentFloor = ref(null);