hldy_app_mini/App.vue

32 lines
608 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>
import { connectWs, closeWs } from '@/common/websocketManager.js';
let globalWs = null;
export default {
onLaunch() {
console.log('App Launch');
},
onShow() {
console.log('App Show');
if (uni.getStorageSync('userInfo')) {
// 重置重连计数,确保立即重连
connectWs()
}
},
onHide() {
console.log('App Hide');
if (uni.getStorageSync('userInfo')) {
// 可选择关闭 socket或只是停止心跳
closeWs()
}
}
}
</script>
<style lang="scss">
@import "./uni_modules/vk-uview-ui/index.scss";
/* 每个页面公共css */
</style>