forked from drone/command-center-dashboard

shuishen
2025-04-16 a7e6761ba0cfccdf33ed552eb2d3b783c8e4ab4a
src/components/CommonWeather.vue
@@ -38,20 +38,18 @@
      isFly.value = res.data.data.flightAdvice
      windVelocity.value = res.data.data.windPower
      flylevel.value = res.data.data.adcode.replace(/0+$/, "").length
   })
}
let intervalTime
onMounted(() => {
   getWeatherSuggest()
   updateTime() // 立即执行一次
   time.value = setInterval(updateTime, 1000)
   intervalTime = setInterval(updateTime, 1000)
})
onUnmounted(() => {
   if (time.value) {
      clearInterval(time.value)
      time.value = null
   if (intervalTime) {
      clearInterval(intervalTime)
      intervalTime = null
   }
})
</script>
@@ -64,15 +62,17 @@
   height: 36px;
   line-height: 36px;
   display: flex;
   justify-content: space-between;
   align-items: center;
   color: #e7f5ff;
   .line {
      border: 1px solid #ffffff;
      height: 10px;
      opacity: 0.5;
      margin: 0 18px;
   }
   .weather {
      display: flex;
      align-items: center;
      img {
         width: 20px;
         height: 20px;
@@ -94,4 +94,4 @@
      }
   }
}
</style>
</style>