From d7d4112e70c7c2f5fe3f54622c0127b6e0dc4dbc Mon Sep 17 00:00:00 2001 From: hi2hi Date: Tue, 25 Mar 2025 16:34:59 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20=E5=A2=9E=E5=8A=A0=E8=A7=A6?= =?UTF-8?q?=E6=91=B8=E4=BA=8B=E4=BB=B6=E5=A4=84=E7=90=86=EF=BC=8C=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E9=95=BF=E6=8C=89=E5=88=87=E6=8D=A2=E5=88=86=E7=B1=BB?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=EF=BC=8C=E4=BC=98=E5=8C=96=E7=A7=BB=E5=8A=A8?= =?UTF-8?q?=E7=AB=AF=E7=94=A8=E6=88=B7=E4=BD=93=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../server-detail/server-monitor.vue | 32 ++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/src/views/components/server-detail/server-monitor.vue b/src/views/components/server-detail/server-monitor.vue index 1cacf47..d0f2eed 100644 --- a/src/views/components/server-detail/server-monitor.vue +++ b/src/views/components/server-detail/server-monitor.vue @@ -82,6 +82,9 @@ '--cate-color': cateItem.color, }" @click="toggleShowCate(cateItem.id)" + @touchstart="handleTouchStart(cateItem.id)" + @touchend="handleTouchEnd(cateItem.id)" + @touchmove="handleTouchMove(cateItem.id)" > now.value - (minute.value * 60 * 1000)); @@ -317,9 +320,32 @@ function toggleMinute(value) { } function toggleShowCate(id) { + if (window.innerWidth < 768) { + return; + } showCates.value[id] = !showCates.value[id]; } +function handleTouchStart(id) { + longPressTimer.value = setTimeout(() => { + showCates.value[id] = !showCates.value[id]; + }, 500); +} + +function handleTouchEnd() { + if (longPressTimer.value) { + clearTimeout(longPressTimer.value); + longPressTimer.value = null; + } +} + +function handleTouchMove() { + if (longPressTimer.value) { + clearTimeout(longPressTimer.value); + longPressTimer.value = null; + } +} + async function loadMonitor() { await request({ url: ( @@ -548,6 +574,10 @@ onUnmounted(() => { border-radius: 4px; cursor: pointer; + @media screen and (max-width: 768px) { + cursor: default; + } + .cate-legend { width: 0.5em; height: 0.5em;