'创建鸿蒙应用'
This commit is contained in:
63
src/App.vue
Normal file
63
src/App.vue
Normal file
@@ -0,0 +1,63 @@
|
||||
<script setup lang="ts">
|
||||
import jxMOdal from '@/components/dialog/dialogUtil'
|
||||
// import { onLaunch, onShow } from '@dcloudio/uni-app'
|
||||
import App from './App'
|
||||
import globalAlert from '@/components/globalAlert/globalAlert'
|
||||
import useGlobalFunc from './composables/useGlobalFunc'
|
||||
// import { isOpenNotice } from './utils/android_ios'
|
||||
import { getStorage, setStorage } from './utils/storage'
|
||||
import { store } from "@/store";
|
||||
import { onLaunch, onShow, onHide } from "@dcloudio/uni-app";
|
||||
|
||||
const {
|
||||
appKeepAlive, // 应用保活
|
||||
listenMsg, // 监听消息
|
||||
} = App()
|
||||
const { watchVersion } = useGlobalFunc() // 监听版本
|
||||
|
||||
// 三端通用
|
||||
const {
|
||||
SystemInfo, //获取本机设备信息
|
||||
onNetWorkStatusChange, // 监听网络状态
|
||||
onPrinterChange, // 监听打印机状态
|
||||
} = App()
|
||||
|
||||
onLaunch(() => {
|
||||
SystemInfo() // 获取本机设备信息
|
||||
uni['jxAlert'] = jxMOdal.alert // 全局挂载 jxMOdal
|
||||
uni['jxConfirm'] = jxMOdal.confirm // 全局挂载 jxMOdal
|
||||
onNetWorkStatusChange() // 监听网络状态
|
||||
onPrinterChange() // 监听打印机状态
|
||||
// appKeepAlive() // 应用保活
|
||||
// listenMsg() // 监听消息穿透
|
||||
|
||||
uni['globalAlert'] = globalAlert // 挂载全局可覆盖tabar弹窗
|
||||
// plus.device.setWakelock(true) //打开程序后一直保持唤醒状态(常亮)
|
||||
watchVersion((isUpdate: boolean) => {
|
||||
// 检查是否更新版本
|
||||
if (isUpdate) {
|
||||
// uni.globalAlert({
|
||||
// data: {
|
||||
// type: 3,
|
||||
// },
|
||||
// })
|
||||
}
|
||||
})
|
||||
|
||||
// 初始化平台
|
||||
if (!getStorage('terrace')) setStorage('terrace', 'jxcs')
|
||||
store.dispatch('serveInfo/get_services')
|
||||
});
|
||||
onShow(() => {
|
||||
console.log("App Show");
|
||||
});
|
||||
onHide(() => {
|
||||
console.log("App Hide");
|
||||
});
|
||||
</script>
|
||||
<style>
|
||||
@import './static/font/iconfont.css';
|
||||
page {
|
||||
background-color: #efefef;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user