feat(app): 初始化逻辑中增加iOS网络权限检查
- 在onShow生命周期中添加异步处理 - 引入sheep对象用于平台判断和网络检测 - iOS平台下网络授权后重新加载应用初始化 - 优化应用启动时的网络状态处理逻辑pull/171/head
parent
5724bc61b0
commit
ee25d77d58
12
App.vue
12
App.vue
|
|
@ -1,7 +1,6 @@
|
|||
<script setup>
|
||||
import { onLaunch, onShow, onError } from '@dcloudio/uni-app';
|
||||
import { ShoproInit } from './sheep';
|
||||
|
||||
import { sheep, ShoproInit } from '@/sheep';
|
||||
onLaunch(() => {
|
||||
// 隐藏原生导航栏 使用自定义底部导航
|
||||
uni.hideTabBar({
|
||||
|
|
@ -12,7 +11,7 @@
|
|||
ShoproInit();
|
||||
});
|
||||
|
||||
onShow(() => {
|
||||
onShow(async () => {
|
||||
// #ifdef APP-PLUS
|
||||
// 获取urlSchemes参数
|
||||
const args = plus.runtime.arguments;
|
||||
|
|
@ -23,6 +22,13 @@
|
|||
uni.getClipboardData({
|
||||
success: (res) => {},
|
||||
});
|
||||
|
||||
// ios 网络授权后重新加载一次应用初始化
|
||||
if (sheep.$platform.os === 'ios') {
|
||||
if (await sheep.$platform.checkNetwork()) {
|
||||
await sheep.$store('app').init();
|
||||
}
|
||||
}
|
||||
// #endif
|
||||
});
|
||||
</script>
|
||||
|
|
|
|||
Loading…
Reference in New Issue