mirror of
https://gitee.com/blossom-editor/blossom.git
synced 2025-12-06 16:58:26 +08:00
生命周期优化
This commit is contained in:
parent
25476d417f
commit
329dd1a909
@ -85,17 +85,20 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, onMounted, onActivated } from 'vue'
|
||||
import { ref } from 'vue'
|
||||
import { useUserStore } from '@renderer/stores/user'
|
||||
import { getAll, refreshApi } from '@renderer/api/weather'
|
||||
import { useLifecycle } from '@renderer/scripts/lifecycle'
|
||||
|
||||
onMounted(() => {
|
||||
refreshWeatherTask()
|
||||
})
|
||||
|
||||
onActivated(() => {
|
||||
getWeather()
|
||||
})
|
||||
useLifecycle(
|
||||
() => {
|
||||
refreshWeatherTask()
|
||||
getWeather()
|
||||
},
|
||||
() => {
|
||||
getWeather()
|
||||
}
|
||||
)
|
||||
|
||||
const userStore = useUserStore()
|
||||
|
||||
|
||||
@ -22,8 +22,20 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { articleWordsApi, pictureStatApi } from '@renderer/api/blossom'
|
||||
import { onActivated, ref } from 'vue'
|
||||
import { ref } from 'vue'
|
||||
import { formatFileSize, formartNumber } from '@renderer/assets/utils/util'
|
||||
import { useLifecycle } from '@renderer/scripts/lifecycle'
|
||||
|
||||
useLifecycle(
|
||||
() => {
|
||||
getArticleWords()
|
||||
getPictureStat()
|
||||
},
|
||||
() => {
|
||||
getArticleWords()
|
||||
getPictureStat()
|
||||
}
|
||||
)
|
||||
|
||||
let article = ref({ articleCount: 0, articleWords: 0 })
|
||||
let picture = ref({ pictureCount: 0, pictureSize: 0 })
|
||||
@ -39,11 +51,6 @@ const getPictureStat = () => {
|
||||
picture.value = resp.data
|
||||
})
|
||||
}
|
||||
|
||||
onActivated(() => {
|
||||
getArticleWords()
|
||||
getPictureStat()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
|
||||
@ -33,7 +33,6 @@ const props = defineProps({
|
||||
}
|
||||
})
|
||||
|
||||
// -------------------- ref
|
||||
const rqLoading = ref<boolean>(true)
|
||||
const ChartLineMetricRef = ref<any>(null)
|
||||
let chartLineMetric: any
|
||||
@ -46,7 +45,6 @@ let chartData = {
|
||||
maxVisual: 0
|
||||
}
|
||||
|
||||
// -------------------- methods
|
||||
/**
|
||||
* 查询指标数据
|
||||
* @param resource 资源
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user