<script setup>
	import {
		onLaunch,
		onShow,
		onHide,
		onError,
		onPageNotFound,
	} from "@dcloudio/uni-app";
	import {
		checkForUpdate
	} from "@/utils";

	onLaunch(() => {
		console.log("App Launch");
		// #ifdef MP-WEIXIN
		checkForUpdate();
		// #endif
		
		// #ifdef H5
		if (navigator.userAgent.toLowerCase().indexOf('micromessenger') !== -1) {
			// 动态添加样式处理重复标题问题
			const style = document.createElement('style')
			style.textContent = `
		    uni-page-head {
		  		  display:none !important;
		    }       
  	  `
			document.head.appendChild(style)
		}
		// #endif
	});

	onShow(() => {
		console.log("App Show");
	});

	onHide(() => {
		console.log("App Hide");
	});

	onError((error) => {
		console.error("App Error", error);
	});

	onPageNotFound((res) => {
		console.error("PageNotFound", res);
		uni.redirectTo({
			url: "/pages/404/404",
		});
	});
</script>

<style lang="scss">
	/* 每个页面公共css */
	page {
		height: 100%;
	}

	/* uv-ui基础样式 */
	@import "@/uni_modules/uv-ui-tools/index.scss";
</style>