39 lines
957 B
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<script setup lang="ts">
import { onLaunch, onShow, onHide } from "@dcloudio/uni-app"
import { startPolling, stopPolling } from "@/utils/messageManager"
onLaunch(() => {
console.log("App Launch")
// 启动消息轮询30秒一次
startPolling(30000)
})
onShow(() => {
console.log("App Show")
// 应用从后台切换到前台时,重新启动轮询
startPolling(30000)
})
onHide(() => {
console.log("App Hide")
// 应用切换到后台时,停止轮询以节省资源
stopPolling()
})
</script>
<style>
/* 全局盒模型设置 */
*, *::before, *::after {
box-sizing: border-box;
}
/* 全局字体设置 */
body {
font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}
/* uni-app 组件也应用 border-box */
page, view, text, image, button, input, textarea, scroll-view, swiper, picker {
box-sizing: border-box;
}
</style>