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)`; //注意子元素逆向旋转 +}