Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
20岁爱吃必胜客
uni-app
提交
66c17401
U
uni-app
项目概览
20岁爱吃必胜客
/
uni-app
与 Fork 源项目一致
Fork自
DCloud / uni-app
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-app
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
66c17401
编写于
11月 26, 2019
作者:
fxy060608
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(v3): improve navigate logic
上级
dc0c688e
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
110 addition
and
47 deletion
+110
-47
packages/uni-app-plus/dist/index.v3.js
packages/uni-app-plus/dist/index.v3.js
+93
-33
src/platforms/app-plus/service/api/route/navigate-to.js
src/platforms/app-plus/service/api/route/navigate-to.js
+4
-3
src/platforms/app-plus/service/api/route/switch-tab.js
src/platforms/app-plus/service/api/route/switch-tab.js
+7
-6
src/platforms/app-plus/service/framework/navigator.js
src/platforms/app-plus/service/framework/navigator.js
+3
-3
src/platforms/app-plus/service/framework/subscribe-handlers/on-webview-ready.js
.../service/framework/subscribe-handlers/on-webview-ready.js
+3
-2
未找到文件。
packages/uni-app-plus/dist/index.v3.js
浏览文件 @
66c17401
...
...
@@ -1601,6 +1601,37 @@ var serviceContext = (function () {
removeStorageSync
:
removeStorageSync
});
const
loadFontFace
=
{
family
:
{
type
:
String
,
required
:
true
},
source
:
{
type
:
String
,
required
:
true
},
desc
:
{
type
:
Object
,
required
:
false
},
success
:
{
type
:
Function
,
required
:
false
},
fail
:
{
type
:
Function
,
required
:
false
},
complete
:
{
type
:
Function
,
required
:
false
}
};
var
require_context_module_0_24
=
/*#__PURE__*/
Object
.
freeze
({
loadFontFace
:
loadFontFace
});
const
FRONT_COLORS
=
[
'
#ffffff
'
,
'
#000000
'
];
const
setNavigationBarColor
=
{
'
frontColor
'
:
{
...
...
@@ -1639,7 +1670,7 @@ var serviceContext = (function () {
}
};
var
require_context_module_0_2
4
=
/*#__PURE__*/
Object
.
freeze
({
var
require_context_module_0_2
5
=
/*#__PURE__*/
Object
.
freeze
({
setNavigationBarColor
:
setNavigationBarColor
,
setNavigationBarTitle
:
setNavigationBarTitle
});
...
...
@@ -1658,7 +1689,7 @@ var serviceContext = (function () {
}
};
var
require_context_module_0_2
5
=
/*#__PURE__*/
Object
.
freeze
({
var
require_context_module_0_2
6
=
/*#__PURE__*/
Object
.
freeze
({
pageScrollTo
:
pageScrollTo
});
...
...
@@ -1775,7 +1806,7 @@ var serviceContext = (function () {
}
};
var
require_context_module_0_2
6
=
/*#__PURE__*/
Object
.
freeze
({
var
require_context_module_0_2
7
=
/*#__PURE__*/
Object
.
freeze
({
showModal
:
showModal
,
showToast
:
showToast
,
showLoading
:
showLoading
,
...
...
@@ -1859,7 +1890,7 @@ var serviceContext = (function () {
}
};
var
require_context_module_0_2
7
=
/*#__PURE__*/
Object
.
freeze
({
var
require_context_module_0_2
8
=
/*#__PURE__*/
Object
.
freeze
({
setTabBarItem
:
setTabBarItem
,
setTabBarStyle
:
setTabBarStyle
,
hideTabBar
:
hideTabBar
,
...
...
@@ -1898,10 +1929,11 @@ var serviceContext = (function () {
'
./plugin/get-provider.js
'
:
require_context_module_0_21
,
'
./route/route.js
'
:
require_context_module_0_22
,
'
./storage/storage.js
'
:
require_context_module_0_23
,
'
./ui/navigation-bar.js
'
:
require_context_module_0_24
,
'
./ui/page-scroll-to.js
'
:
require_context_module_0_25
,
'
./ui/popup.js
'
:
require_context_module_0_26
,
'
./ui/tab-bar.js
'
:
require_context_module_0_27
,
'
./ui/load-font-face.js
'
:
require_context_module_0_24
,
'
./ui/navigation-bar.js
'
:
require_context_module_0_25
,
'
./ui/page-scroll-to.js
'
:
require_context_module_0_26
,
'
./ui/popup.js
'
:
require_context_module_0_27
,
'
./ui/tab-bar.js
'
:
require_context_module_0_28
,
};
var
req
=
function
req
(
key
)
{
...
...
@@ -2554,7 +2586,7 @@ var serviceContext = (function () {
const
oldSetStatusBarStyle
=
plus
.
navigator
.
setStatusBarStyle
;
function
newSetStatusBarStyle
(
style
)
{
function
newSetStatusBarStyle
(
style
)
{
lastStatusBarStyle
=
style
;
oldSetStatusBarStyle
(
style
);
}
...
...
@@ -7560,10 +7592,10 @@ var serviceContext = (function () {
let
todoNavigator
=
false
;
function
navigate
(
path
,
callback
)
{
function
navigate
(
path
,
callback
,
isAppLaunch
)
{
{
if
(
todoNavigator
)
{
return
console
.
error
(
`已存在待跳转页面
${
todoNavigator
.
path
}
,请不要连续多次跳转页面`
)
if
(
!
isAppLaunch
&&
todoNavigator
)
{
return
console
.
error
(
`已存在待跳转页面
${
todoNavigator
.
path
}
,请不要连续多次跳转页面
${
path
}
`
)
}
// 未创建 preloadWebview 或 preloadWebview 已被使用
const
waitPreloadWebview
=
!
preloadWebview
||
(
preloadWebview
&&
preloadWebview
.
__uniapp_route
);
...
...
@@ -7786,11 +7818,11 @@ var serviceContext = (function () {
query
,
animationType
,
animationDuration
},
callbackId
)
{
},
callbackId
)
{
UniServiceJSBridge
.
emit
(
'
onAppRoute
'
,
{
type
:
'
navigateTo
'
,
path
});
});
showWebview
(
registerPage
({
...
...
@@ -7811,6 +7843,7 @@ var serviceContext = (function () {
function
navigateTo$1
({
url
,
openType
,
animationType
,
animationDuration
})
{
...
...
@@ -7824,7 +7857,7 @@ var serviceContext = (function () {
animationType
,
animationDuration
});
});
}
,
openType
===
'
appLaunch
'
);
}
function
_reLaunch
({
...
...
@@ -7920,7 +7953,7 @@ var serviceContext = (function () {
function
_switchTab
({
path
,
from
},
callbackId
)
{
},
callbackId
)
{
tabBar$1
.
switchTab
(
path
.
slice
(
1
));
const
pages
=
getCurrentPages
();
...
...
@@ -7982,11 +8015,12 @@ var serviceContext = (function () {
return
{
errMsg
:
'
switchTab:ok
'
}
}
}
function
switchTab$1
({
url
,
from
from
,
openType
})
{
const
path
=
url
.
split
(
'
?
'
)[
0
];
navigate
(
path
,
function
()
{
...
...
@@ -7994,7 +8028,7 @@ var serviceContext = (function () {
path
,
from
});
});
}
,
openType
===
'
appLaunch
'
);
}
function
showKeyboard
()
{
...
...
@@ -8517,11 +8551,15 @@ var serviceContext = (function () {
var
api
=
/*#__PURE__*/
Object
.
freeze
({
startPullDownRefresh
:
startPullDownRefresh
,
stopPullDownRefresh
:
stopPullDownRefresh
,
compressImage
:
compressImage
,
$on
:
$on$1
,
$off
:
$off$1
,
$once
:
$once$1
,
$emit
:
$emit$1
,
createAudioInstance
:
createAudioInstance
,
destroyAudioInstance
:
destroyAudioInstance
,
setAudioState
:
setAudioState
,
getAudioState
:
getAudioState
,
operateAudio
:
operateAudio
,
getMusicPlayerState
:
getMusicPlayerState
,
operateMusicPlayer
:
operateMusicPlayer
,
setBackgroundAudioState
:
setBackgroundAudioState
,
...
...
@@ -8584,11 +8622,7 @@ var serviceContext = (function () {
stopVoice
:
stopVoice
,
chooseImage
:
chooseImage$1
,
chooseVideo
:
chooseVideo$1
,
createAudioInstance
:
createAudioInstance
,
destroyAudioInstance
:
destroyAudioInstance
,
setAudioState
:
setAudioState
,
getAudioState
:
getAudioState
,
operateAudio
:
operateAudio
,
compressImage
:
compressImage
,
getImageInfo
:
getImageInfo$1
,
previewImage
:
previewImage$1
,
operateRecorder
:
operateRecorder
,
...
...
@@ -10992,6 +11026,30 @@ var serviceContext = (function () {
onKeyboardHeightChange
:
onKeyboardHeightChange
});
UniServiceJSBridge
.
subscribe
(
'
onLoadFontFaceCallback
'
,
({
callbackId
,
data
})
=>
{
invoke
(
callbackId
,
data
);
});
function
loadFontFace$1
(
options
,
callbackId
)
{
const
pageId
=
getCurrentPageId
();
if
(
!
pageId
)
{
return
{
errMsg
:
'
loadFontFace:fail not font page
'
}
}
UniServiceJSBridge
.
publishHandler
(
'
loadFontFace
'
,
{
options
,
callbackId
},
pageId
);
}
var
require_context_module_1_23
=
/*#__PURE__*/
Object
.
freeze
({
loadFontFace
:
loadFontFace$1
});
function
pageScrollTo$1
(
args
)
{
const
pages
=
getCurrentPages
();
if
(
pages
.
length
)
{
...
...
@@ -11000,7 +11058,7 @@ var serviceContext = (function () {
return
{}
}
var
require_context_module_1_2
3
=
/*#__PURE__*/
Object
.
freeze
({
var
require_context_module_1_2
4
=
/*#__PURE__*/
Object
.
freeze
({
pageScrollTo
:
pageScrollTo$1
});
...
...
@@ -11036,7 +11094,7 @@ var serviceContext = (function () {
callbacks$a
.
push
(
callbackId
);
}
var
require_context_module_1_2
4
=
/*#__PURE__*/
Object
.
freeze
({
var
require_context_module_1_2
5
=
/*#__PURE__*/
Object
.
freeze
({
removeTabBarBadge
:
removeTabBarBadge$1
,
showTabBarRedDot
:
showTabBarRedDot$1
,
hideTabBarRedDot
:
hideTabBarRedDot$1
,
...
...
@@ -11061,7 +11119,7 @@ var serviceContext = (function () {
callbacks$b
.
splice
(
callbacks$b
.
indexOf
(
callbackId
),
1
);
}
var
require_context_module_1_2
5
=
/*#__PURE__*/
Object
.
freeze
({
var
require_context_module_1_2
6
=
/*#__PURE__*/
Object
.
freeze
({
onWindowResize
:
onWindowResize
,
offWindowResize
:
offWindowResize
});
...
...
@@ -11094,9 +11152,10 @@ var serviceContext = (function () {
'
./ui/create-intersection-observer.js
'
:
require_context_module_1_20
,
'
./ui/create-selector-query.js
'
:
require_context_module_1_21
,
'
./ui/keyboard.js
'
:
require_context_module_1_22
,
'
./ui/page-scroll-to.js
'
:
require_context_module_1_23
,
'
./ui/tab-bar.js
'
:
require_context_module_1_24
,
'
./ui/window.js
'
:
require_context_module_1_25
,
'
./ui/load-font-face.js
'
:
require_context_module_1_23
,
'
./ui/page-scroll-to.js
'
:
require_context_module_1_24
,
'
./ui/tab-bar.js
'
:
require_context_module_1_25
,
'
./ui/window.js
'
:
require_context_module_1_26
,
};
var
req
=
function
req
(
key
)
{
...
...
@@ -11307,7 +11366,7 @@ var serviceContext = (function () {
let
isLaunchWebviewReady
=
false
;
// 目前首页双向确定 ready,可能会导致触发两次 onWebviewReady(主要是 Android)
function
onWebviewReady
(
data
,
pageId
)
{
function
onWebviewReady
(
data
,
pageId
)
{
const
isLaunchWebview
=
pageId
===
'
1
'
;
if
(
isLaunchWebview
&&
isLaunchWebviewReady
)
{
if
(
process
.
env
.
NODE_ENV
!==
'
production
'
)
{
...
...
@@ -11335,7 +11394,8 @@ var serviceContext = (function () {
const
navigateType
=
routeOptions
.
meta
.
isTabBar
?
'
switchTab
'
:
'
navigateTo
'
;
process
.
env
.
NODE_ENV
!==
'
production
'
&&
perf
(
`
${
entryPagePath
}
navigateTo`
);
return
uni
[
navigateType
]({
url
:
entryPagePath
url
:
entryPagePath
,
openType
:
'
appLaunch
'
})
}
}
...
...
src/platforms/app-plus/service/api/route/navigate-to.js
浏览文件 @
66c17401
...
...
@@ -24,11 +24,11 @@ function _navigateTo ({
query
,
animationType
,
animationDuration
},
callbackId
)
{
},
callbackId
)
{
UniServiceJSBridge
.
emit
(
'
onAppRoute
'
,
{
type
:
'
navigateTo
'
,
path
})
})
showWebview
(
registerPage
({
...
...
@@ -49,6 +49,7 @@ function _navigateTo ({
export
function
navigateTo
({
url
,
openType
,
animationType
,
animationDuration
})
{
...
...
@@ -62,5 +63,5 @@ export function navigateTo ({
animationType
,
animationDuration
})
})
}
,
openType
===
'
appLaunch
'
)
}
src/platforms/app-plus/service/api/route/switch-tab.js
浏览文件 @
66c17401
import
{
ANI_CLOSE
,
ANI_DURATION
}
from
'
../../constants
'
}
from
'
../../constants
'
import
{
showWebview
}
from
'
./util
'
...
...
@@ -25,7 +25,7 @@ import tabBar from '../../framework/tab-bar'
function
_switchTab
({
path
,
from
},
callbackId
)
{
},
callbackId
)
{
tabBar
.
switchTab
(
path
.
slice
(
1
))
const
pages
=
getCurrentPages
()
...
...
@@ -87,11 +87,12 @@ function _switchTab ({
return
{
errMsg
:
'
switchTab:ok
'
}
}
}
export
function
switchTab
({
url
,
from
from
,
openType
})
{
const
path
=
url
.
split
(
'
?
'
)[
0
]
navigate
(
path
,
function
()
{
...
...
@@ -99,5 +100,5 @@ export function switchTab ({
path
,
from
})
})
}
,
openType
===
'
appLaunch
'
)
}
src/platforms/app-plus/service/framework/navigator.js
浏览文件 @
66c17401
...
...
@@ -6,10 +6,10 @@ import {
let
todoNavigator
=
false
export
function
navigate
(
path
,
callback
)
{
export
function
navigate
(
path
,
callback
,
isAppLaunch
)
{
if
(
__PLATFORM__
===
'
app-plus
'
)
{
if
(
todoNavigator
)
{
return
console
.
error
(
`已存在待跳转页面
${
todoNavigator
.
path
}
,请不要连续多次跳转页面`
)
if
(
!
isAppLaunch
&&
todoNavigator
)
{
return
console
.
error
(
`已存在待跳转页面
${
todoNavigator
.
path
}
,请不要连续多次跳转页面
${
path
}
`
)
}
// 未创建 preloadWebview 或 preloadWebview 已被使用
const
waitPreloadWebview
=
!
preloadWebview
||
(
preloadWebview
&&
preloadWebview
.
__uniapp_route
)
...
...
src/platforms/app-plus/service/framework/subscribe-handlers/on-webview-ready.js
浏览文件 @
66c17401
...
...
@@ -10,7 +10,7 @@ import {
let
isLaunchWebviewReady
=
false
// 目前首页双向确定 ready,可能会导致触发两次 onWebviewReady(主要是 Android)
export
default
function
onWebviewReady
(
data
,
pageId
)
{
export
default
function
onWebviewReady
(
data
,
pageId
)
{
const
isLaunchWebview
=
pageId
===
'
1
'
if
(
isLaunchWebview
&&
isLaunchWebviewReady
)
{
if
(
process
.
env
.
NODE_ENV
!==
'
production
'
)
{
...
...
@@ -38,7 +38,8 @@ export default function onWebviewReady (data, pageId) {
const
navigateType
=
routeOptions
.
meta
.
isTabBar
?
'
switchTab
'
:
'
navigateTo
'
process
.
env
.
NODE_ENV
!==
'
production
'
&&
perf
(
`
${
entryPagePath
}
navigateTo`
)
return
uni
[
navigateType
]({
url
:
entryPagePath
url
:
entryPagePath
,
openType
:
'
appLaunch
'
})
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录