Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
uni-app
提交
31a17b88
U
uni-app
项目概览
DCloud
/
uni-app
3 个月 前同步成功
通知
725
Star
38705
Fork
3642
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
7
列表
看板
标记
里程碑
合并请求
1
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-app
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
7
Issue
7
列表
看板
标记
里程碑
合并请求
1
合并请求
1
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
31a17b88
编写于
11月 25, 2021
作者:
fxy060608
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(app): popGesture with reLaunch
上级
3c0e95e9
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
72 addition
and
32 deletion
+72
-32
packages/uni-app-plus/dist/uni-app-service.es.js
packages/uni-app-plus/dist/uni-app-service.es.js
+32
-14
packages/uni-app-plus/src/service/api/route/direct.ts
packages/uni-app-plus/src/service/api/route/direct.ts
+23
-0
packages/uni-app-plus/src/service/api/route/navigateBack.ts
packages/uni-app-plus/src/service/api/route/navigateBack.ts
+6
-13
packages/uni-app-plus/src/service/framework/page/routeOptions.ts
...s/uni-app-plus/src/service/framework/page/routeOptions.ts
+2
-2
packages/uni-app-plus/src/service/framework/webview/init/event/popGesture.ts
...us/src/service/framework/webview/init/event/popGesture.ts
+9
-3
未找到文件。
packages/uni-app-plus/dist/uni-app-service.es.js
浏览文件 @
31a17b88
...
...
@@ -17168,8 +17168,8 @@ var serviceContext = (function (vue) {
// 需要序列化一遍
const routeOptions = JSON.parse(JSON.stringify(getRouteOptions(path)));
routeOptions.meta = initRouteMeta(routeOptions.meta);
if (
openType === 'reLaunch' ||
(
!__uniConfig.realEntryPagePath &&
getCurrentPages().length === 0) // redirectTo
if (
!__uniConfig.realEntryPagePath &&
(
openType === 'reLaunch' ||
getCurrentPages().length === 0) // redirectTo
) {
routeOptions.meta.isQuit = true;
}
...
...
@@ -17501,6 +17501,26 @@ var serviceContext = (function (vue) {
});
}
/**
* 是否处于直达页面
* @param page
* @returns
*/
function isDirectPage(page) {
return (__uniConfig.realEntryPagePath &&
page.$page.route === __uniConfig.entryPagePath);
}
/**
* 重新启动到首页
*/
function reLaunchEntryPage() {
__uniConfig.entryPagePath = __uniConfig.realEntryPagePath;
delete __uniConfig.realEntryPagePath;
uni.reLaunch({
url: addLeadingSlash(__uniConfig.entryPagePath),
});
}
let lastStatusBarStyle;
let oldSetStatusBarStyle = plus.navigator.setStatusBarStyle;
function restoreOldSetStatusBarStyle(setStatusBarStyle) {
...
...
@@ -17621,10 +17641,16 @@ var serviceContext = (function (vue) {
setStatusBarStyle(popStartStatusBarStyle);
}
else if (e.type === 'end' && e.result) {
const page = getCurrentPage();
removeCurrentPage();
setStatusBarStyle();
// 触发前一个页面 onShow
invokeHook(ON_SHOW);
if (page && isDirectPage(page)) {
reLaunchEntryPage();
}
else {
// 触发前一个页面 onShow
invokeHook(ON_SHOW);
}
}
});
}
...
...
@@ -19520,16 +19546,8 @@ var serviceContext = (function (vue) {
if (page.$page.meta.isQuit) {
quit();
}
else if (
// 处于直达页面
page.$page.route === __uniConfig.entryPagePath &&
__uniConfig.realEntryPagePath) {
// condition
__uniConfig.entryPagePath = __uniConfig.realEntryPagePath;
delete __uniConfig.realEntryPagePath;
uni.reLaunch({
url: addLeadingSlash(__uniConfig.entryPagePath),
});
else if (isDirectPage(page)) {
reLaunchEntryPage();
}
else {
const { delta, animationType, animationDuration } = args;
...
...
packages/uni-app-plus/src/service/api/route/direct.ts
0 → 100644
浏览文件 @
31a17b88
import
{
addLeadingSlash
}
from
'
@dcloudio/uni-shared
'
/**
* 是否处于直达页面
* @param page
* @returns
*/
export
function
isDirectPage
(
page
:
Page
.
PageInstance
)
{
return
(
__uniConfig
.
realEntryPagePath
&&
page
.
$page
.
route
===
__uniConfig
.
entryPagePath
)
}
/**
* 重新启动到首页
*/
export
function
reLaunchEntryPage
()
{
__uniConfig
.
entryPagePath
=
__uniConfig
.
realEntryPagePath
delete
__uniConfig
.
realEntryPagePath
uni
.
reLaunch
({
url
:
addLeadingSlash
(
__uniConfig
.
entryPagePath
!
),
})
}
packages/uni-app-plus/src/service/api/route/navigateBack.ts
浏览文件 @
31a17b88
import
{
ComponentPublicInstance
}
from
'
vue
'
import
{
API_NAVIGATE_BACK
,
API_TYPE_NAVIGATE_BACK
,
...
...
@@ -11,12 +12,13 @@ import {
invokeHook
,
}
from
'
@dcloudio/uni-core
'
import
{
useI18n
}
from
'
@dcloudio/uni-core
'
import
{
addLeadingSlash
,
ON_BACK_PRESS
,
ON_SHOW
}
from
'
@dcloudio/uni-shared
'
import
{
ComponentPublicInstance
}
from
'
vue
'
import
{
ON_BACK_PRESS
,
ON_SHOW
}
from
'
@dcloudio/uni-shared
'
import
{
ANI_CLOSE
,
ANI_DURATION
}
from
'
../../constants
'
import
{
removePage
}
from
'
../../framework/page/getCurrentPages
'
import
{
setStatusBarStyle
}
from
'
../../statusBar
'
import
{
backWebview
,
closeWebview
}
from
'
./webview
'
import
{
isDirectPage
,
reLaunchEntryPage
}
from
'
./direct
'
export
const
navigateBack
=
defineAsyncApi
<
API_TYPE_NAVIGATE_BACK
>
(
API_NAVIGATE_BACK
,
...
...
@@ -36,17 +38,8 @@ export const navigateBack = defineAsyncApi<API_TYPE_NAVIGATE_BACK>(
uni
.
hideLoading
()
if
(
page
.
$page
.
meta
.
isQuit
)
{
quit
()
}
else
if
(
// 处于直达页面
page
.
$page
.
route
===
__uniConfig
.
entryPagePath
&&
__uniConfig
.
realEntryPagePath
)
{
// condition
__uniConfig
.
entryPagePath
=
__uniConfig
.
realEntryPagePath
delete
__uniConfig
.
realEntryPagePath
uni
.
reLaunch
({
url
:
addLeadingSlash
(
__uniConfig
.
entryPagePath
),
})
}
else
if
(
isDirectPage
(
page
))
{
reLaunchEntryPage
()
}
else
{
const
{
delta
,
animationType
,
animationDuration
}
=
args
back
(
delta
!
,
animationType
,
animationDuration
)
...
...
packages/uni-app-plus/src/service/framework/page/routeOptions.ts
浏览文件 @
31a17b88
...
...
@@ -9,8 +9,8 @@ export function initRouteOptions(path: string, openType: UniApp.OpenType) {
routeOptions
.
meta
=
initRouteMeta
(
routeOptions
.
meta
)
if
(
openType
===
'
reLaunch
'
||
(
!
__uniConfig
.
realEntryPagePath
&&
getCurrentPages
().
length
===
0
)
// redirectTo
!
__uniConfig
.
realEntryPagePath
&&
(
openType
===
'
reLaunch
'
||
getCurrentPages
().
length
===
0
)
// redirectTo
)
{
routeOptions
.
meta
.
isQuit
=
true
}
else
if
(
!
routeOptions
.
meta
.
isTabBar
)
{
...
...
packages/uni-app-plus/src/service/framework/webview/init/event/popGesture.ts
浏览文件 @
31a17b88
import
{
invokeHook
}
from
'
@dcloudio/uni-core
'
import
{
getCurrentPage
,
invokeHook
}
from
'
@dcloudio/uni-core
'
import
{
ON_SHOW
}
from
'
@dcloudio/uni-shared
'
import
{
isDirectPage
,
reLaunchEntryPage
}
from
'
../../../../api/route/direct
'
import
{
lastStatusBarStyle
,
setStatusBarStyle
,
...
...
@@ -22,10 +23,15 @@ export function onWebviewPopGesture(webview: PlusWebviewWebviewObject) {
// 拖拽未完成,设置为当前状态栏前景色
setStatusBarStyle
(
popStartStatusBarStyle
)
}
else
if
(
e
.
type
===
'
end
'
&&
e
.
result
)
{
const
page
=
getCurrentPage
()
removeCurrentPage
()
setStatusBarStyle
()
// 触发前一个页面 onShow
invokeHook
(
ON_SHOW
)
if
(
page
&&
isDirectPage
(
page
))
{
reLaunchEntryPage
()
}
else
{
// 触发前一个页面 onShow
invokeHook
(
ON_SHOW
)
}
}
})
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录