From 779448b465c6d5fd1102b68d87300f77feb60856 Mon Sep 17 00:00:00 2001 From: trp <2477421791@qq.com> Date: Mon, 11 Dec 2023 14:07:03 +0800 Subject: [PATCH] =?UTF-8?q?=E5=94=90=E6=B6=A6=E5=B9=B3=EF=BC=9A=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E5=8F=B3=E4=B8=8B=E8=A7=92=E9=9D=A2=E6=9D=BF=E9=98=88?= =?UTF-8?q?=E5=80=BC=E5=88=BB=E5=BA=A6=E7=BA=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../badGasInfo/childComps/GasInfoItem.vue | 37 ++++- src/main.js | 30 ++-- src/views/login/index.vue | 131 ++++++++++-------- 3 files changed, 124 insertions(+), 74 deletions(-) diff --git a/src/components/content/badGasInfo/childComps/GasInfoItem.vue b/src/components/content/badGasInfo/childComps/GasInfoItem.vue index 5d2ff3c..a650019 100644 --- a/src/components/content/badGasInfo/childComps/GasInfoItem.vue +++ b/src/components/content/badGasInfo/childComps/GasInfoItem.vue @@ -1,6 +1,9 @@ @@ -85,6 +88,8 @@ onMounted(handleOnMounted); function handleOnMounted() { e_info = Echarts.init(container.value); e_info.setOption(option); + // 设置阈值 + setPoint(); } watch( () => params.gasInfo.value, @@ -101,13 +106,41 @@ watch( e_info.setOption(option); } ); + +// 获取阈值dom元素 +const point = ref(null); +//手写js实现阈值的在表盘的刻度的位置 +function setPoint() { + const deg = 360 * (params.gasInfo.point / params.gasInfo.max); + point.value.style.transform = `rotate(${deg}deg)`; //旋转指定度数 + point.value.children[0].style.transform = `rotate(${-deg}deg)`; //注意子元素逆向旋转 +}