Pre Merge pull request !171 from wuKong/fix(app)-iOS网络权限检查

pull/171/MERGE
wuKong 2025-12-08 11:02:05 +00:00 committed by Gitee
commit d1c6e2951a
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
1 changed files with 15 additions and 1 deletions

View File

@ -22,7 +22,7 @@
<script setup>
import { computed } from 'vue';
import { onLoad, onPageScroll, onPullDownRefresh } from '@dcloudio/uni-app';
import { onLoad, onShow, onPageScroll, onPullDownRefresh } from '@dcloudio/uni-app';
import sheep from '@/sheep';
import $share from '@/sheep/platform/share';
// 隐藏原生tabBar
@ -79,6 +79,20 @@
}
});
onShow(async() => {
// #ifdef APP-PLUS
// ios首次授权网络,需要重新加载一次应用初始化
// 可能需要考虑上uni.onNetworkStatusChange,uni.offNetworkStatusChange组合拳以及主动主动唤起权限申请
// 一开始放app.vue,感觉负载太重,搬到这里来了。
// 如果你的首页不是这个页面,需要把代码搬过去。
if (sheep.$platform.os === 'ios') {
if (await sheep.$platform.checkNetwork()) {
await sheep.$store('app').init();
}
}
// #endif
});
// 下拉刷新
onPullDownRefresh(() => {
sheep.$store('app').init();