From d01d3e7581e421e233197d1d8847726b9e1110b5 Mon Sep 17 00:00:00 2001 From: ko1234 Date: Fri, 26 Sep 2025 13:44:45 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E6=AD=A3=E6=8B=96=E6=9B=B3?= =?UTF-8?q?=E4=BA=8B=E4=BB=B6=E5=83=85=E5=9C=A8=E7=9B=AE=E6=A8=99=E5=85=83?= =?UTF-8?q?=E7=B4=A0=E4=B8=8A=E8=A7=B8=E7=99=BC=EF=BC=8C=E4=B8=A6=E7=A2=BA?= =?UTF-8?q?=E4=BF=9D=E5=B7=A6=E9=8D=B5=E6=8B=96=E6=9B=B3=E6=9C=89=E6=95=88?= =?UTF-8?q?=E6=80=A7=20|=20=E7=A2=BA=E4=BF=9D=E5=8D=B3=E6=99=82=E6=95=B8?= =?UTF-8?q?=E6=93=9A=E7=82=BA=E9=99=A3=E5=88=97=EF=BC=8C=E9=81=BF=E5=85=8D?= =?UTF-8?q?=E5=8F=8D=E8=BD=89=E6=99=82=E5=87=BA=E7=8F=BE=E9=8C=AF=E8=AA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/directives/draggable.js | 5 ++++- src/views/dashboard/components/DashboardElectricity.vue | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/directives/draggable.js b/src/directives/draggable.js index 726d156..3121b18 100644 --- a/src/directives/draggable.js +++ b/src/directives/draggable.js @@ -4,13 +4,16 @@ const moveModal = (elmnt) => { pos2 = 0, pos3 = 0, pos4 = 0; - document.body.addEventListener("mousedown", dragMouseDown, { + // 只在目標元素上監聽 mousedown,避免全域攔截 + elmnt.addEventListener("mousedown", dragMouseDown, { passive: false, }); function dragMouseDown(e) { console.log("dragMouseDown", e); e = e || window.event; + // 僅當左鍵拖曳才阻止預設(避免影響下拉選單等) + if (e.button !== 0) return; e.preventDefault(); // get the mouse cursor position at startup: pos3 = e.clientX; diff --git a/src/views/dashboard/components/DashboardElectricity.vue b/src/views/dashboard/components/DashboardElectricity.vue index ee619f1..2a42e43 100644 --- a/src/views/dashboard/components/DashboardElectricity.vue +++ b/src/views/dashboard/components/DashboardElectricity.vue @@ -56,7 +56,7 @@ const getData = async () => { const getRealTime = async () => { if (store.selectedBuilding.building_guid) { const res = await getRealTimeDemand(store.selectedBuilding.building_guid); - realTimeDemand.value = res.data.reverse(); + realTimeDemand.value = Array.isArray(res.data) ? res.data.reverse() : []; updateChart(); } };