Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
basic-uniapp-v3
概览
概览
详情
活动
周期分析
版本库
存储库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
Basic
basic-uniapp-v3
Commits
a1a5336f
提交
a1a5336f
authored
9月 05, 2023
作者:
方治民
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: 移除 APP 启动时检查更新,调整到首页进行,搭配手动关闭 splashscreen
上级
8b590b9f
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
33 行增加
和
7 行删除
+33
-7
App.vue
src/App.vue
+0
-5
index.vue
src/pages/index/index.vue
+5
-2
index.ts
src/utils/upgrade/index.ts
+28
-0
没有找到文件。
src/App.vue
浏览文件 @
a1a5336f
<
script
setup
lang=
"ts"
>
<
script
setup
lang=
"ts"
>
import
{
checkUpgrade
}
from
'@/utils/upgrade'
// import * as Push from '@/utils/push'
// import * as Push from '@/utils/push'
onLaunch
(()
=>
{
onLaunch
(()
=>
{
console
.
log
(
'App Launch'
)
console
.
log
(
'App Launch'
)
// 版本更新检查
checkUpgrade
()
// 清除消息角标
// 清除消息角标
// Push.setBadge(0)
// Push.setBadge(0)
...
...
src/pages/index/index.vue
浏览文件 @
a1a5336f
<
script
setup
lang=
"ts"
>
<
script
setup
lang=
"ts"
>
import
dayjs
from
'dayjs'
import
dayjs
from
'dayjs'
import
{
checkUpgrade
}
from
'@/utils/upgrade'
import
{
checkUpgrade
,
closeSplashscreenAndChechUpgrade
}
from
'@/utils/upgrade'
import
{
useRuntime
}
from
'@/hooks/app/useRuntime'
import
{
useRuntime
}
from
'@/hooks/app/useRuntime'
import
{
useConcealedExit
}
from
'@/hooks/app/useConcealedExit'
import
{
useConcealedExit
}
from
'@/hooks/app/useConcealedExit'
...
@@ -10,7 +10,10 @@
...
@@ -10,7 +10,10 @@
const
title
=
ref
(
'Hello World'
)
const
title
=
ref
(
'Hello World'
)
const
version
=
computed
(()
=>
app
.
value
.
version
)
const
version
=
computed
(()
=>
app
.
value
.
version
)
onMounted
(()
=>
{
onLoad
(()
=>
{
// 关闭启动页并检查更新
closeSplashscreenAndChechUpgrade
()
// test API
// test API
API
.
example
.
hello
API
.
example
.
hello
.
request
()
.
request
()
...
...
src/utils/upgrade/index.ts
浏览文件 @
a1a5336f
...
@@ -22,3 +22,31 @@ export function checkUpgrade(toast = false) {
...
@@ -22,3 +22,31 @@ export function checkUpgrade(toast = false) {
})
})
// #endif
// #endif
}
}
/**
* 关闭 splashscreen 并检查更新
*/
export
function
closeSplashscreenAndChechUpgrade
()
{
return
new
Promise
<
void
>
((
resolve
)
=>
{
// FIXED: pages 第一路由页面为登录页,加上 splashscreen 配置控制使得用户体验更好
// #ifdef APP-PLUS
nextTick
(()
=>
{
// FIX: 延时执行,解决安卓环境下可能意外看到登录页的问题
const
{
platform
}
=
uni
.
getSystemInfoSync
()
const
isAndroid
=
platform
===
'android'
setTimeout
(
()
=>
{
plus
.
navigator
.
closeSplashscreen
()
// 检查更新
checkUpgrade
()
resolve
()
},
isAndroid
?
1000
:
50
,
)
})
// #endif
// #ifndef APP-PLUS
resolve
()
// #endif
})
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论