Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
菜鸟程序猿_c
uni-app
提交
adcfdfd2
U
uni-app
项目概览
菜鸟程序猿_c
/
uni-app
与 Fork 源项目一致
Fork自
DCloud / uni-app
通知
1
Star
1
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,发现更多精彩内容 >>
提交
adcfdfd2
编写于
9月 04, 2019
作者:
fxy060608
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat(app-plus-nvue): onTabItemTap,onBackPress
上级
ae221537
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
100 addition
and
62 deletion
+100
-62
packages/uni-app-plus-nvue/dist/index.js
packages/uni-app-plus-nvue/dist/index.js
+49
-30
packages/uni-app-plus-nvue/dist/index.legacy.js
packages/uni-app-plus-nvue/dist/index.legacy.js
+1
-1
src/platforms/app-plus-nvue/service/api/route/navigate-back.js
...latforms/app-plus-nvue/service/api/route/navigate-back.js
+15
-3
src/platforms/app-plus/service/bridge.js
src/platforms/app-plus/service/bridge.js
+3
-2
src/platforms/app-plus/service/framework/app.js
src/platforms/app-plus/service/framework/app.js
+32
-26
未找到文件。
packages/uni-app-plus-nvue/dist/index.js
浏览文件 @
adcfdfd2
...
...
@@ -162,7 +162,8 @@ var serviceContext = (function () {
}
return
page
.
$page
.
meta
.
isTabBar
}
return
!!
__uniRoutes
.
find
(
route
=>
route
.
path
.
slice
(
1
)
===
path
)
const
route
=
__uniRoutes
.
find
(
route
=>
route
.
path
.
slice
(
1
)
===
path
);
return
route
&&
route
.
meta
.
isTabBar
}
catch
(
e
)
{
if
(
process
.
env
.
NODE_ENV
!==
'
production
'
)
{
console
.
log
(
'
getCurrentPages is not ready
'
);
...
...
@@ -1363,7 +1364,6 @@ var serviceContext = (function () {
const
emit
=
UniServiceJSBridge
.
emit
;
plus
.
key
.
addEventListener
(
'
backbutton
'
,
()
=>
{
// TODO uni?
uni
.
navigateBack
({
from
:
'
backbutton
'
});
...
...
@@ -1418,10 +1418,12 @@ var serviceContext = (function () {
return
}
const
currentTab
=
isTabBarPage
(
__uniConfig
.
entryPagePath
);
if
(
currentTab
)
{
__uniConfig
.
tabBar
.
selected
=
0
;
const
selected
=
__uniConfig
.
tabBar
.
list
.
findIndex
(
page
=>
page
.
pagePath
===
__uniConfig
.
entryPagePath
);
if
(
selected
!==
-
1
)
{
// 取当前 tab 索引值
__uniConfig
.
tabBar
.
selected
=
__uniConfig
.
tabBar
.
list
.
indexOf
(
currentTab
)
;
__uniConfig
.
tabBar
.
selected
=
selected
;
// 如果真实的首页与 condition 都是 tabbar,无需启用 realEntryPagePath 机制
if
(
__uniConfig
.
realEntryPagePath
&&
isTabBarPage
(
__uniConfig
.
realEntryPagePath
))
{
delete
__uniConfig
.
realEntryPagePath
;
...
...
@@ -1431,7 +1433,12 @@ var serviceContext = (function () {
__uniConfig
.
__ready__
=
true
;
const
onLaunchWebviewReady
=
function
onLaunchWebviewReady
()
{
const
tabBarView
=
tabBar
.
init
(
__uniConfig
.
tabBar
,
(
item
)
=>
{
const
tabBarView
=
tabBar
.
init
(
__uniConfig
.
tabBar
,
(
item
,
index
)
=>
{
UniServiceJSBridge
.
emit
(
'
onTabItemTap
'
,
{
index
,
text
:
item
.
text
,
pagePath
:
item
.
pagePath
});
uni
.
switchTab
({
url
:
'
/
'
+
item
.
pagePath
,
openType
:
'
switchTab
'
,
...
...
@@ -1938,7 +1945,7 @@ var serviceContext = (function () {
};
const
SYNC_API_RE
=
/^
\$
|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64/
;
/^
\$
|
getMenuButtonBoundingClientRect|
^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64/
;
const
CONTEXT_API_RE
=
/^create|Manager$/
;
...
...
@@ -4882,7 +4889,7 @@ var serviceContext = (function () {
return
{
errMsg
:
'
getSystemInfo:ok
'
,
brand
:
''
,
brand
:
plus
.
device
.
vendor
,
model
:
plus
.
device
.
model
,
pixelRatio
:
plus
.
screen
.
scale
,
screenWidth
,
...
...
@@ -8887,16 +8894,28 @@ var serviceContext = (function () {
}
function
navigateBack$1
({
from
=
'
navigateBack
'
,
delta
,
animationType
,
animationDuration
})
{
const
pages
=
getCurrentPages
();
const
len
=
pages
.
length
;
const
currentPage
=
pages
[
pages
.
length
-
1
];
if
(
currentPage
.
$vm
&&
currentPage
.
$vm
.
$options
.
onBackPress
&&
currentPage
.
$vm
.
__call_hook
&&
currentPage
.
$vm
.
__call_hook
(
'
onBackPress
'
,
{
from
})
)
{
return
}
uni
.
hideToast
();
// 后退时,关闭 toast,loading
pages
[
len
-
1
]
.
$page
.
meta
.
isQuit
currentPage
.
$page
.
meta
.
isQuit
?
quit
()
:
back
(
delta
,
animationType
,
animationDuration
);
}
...
...
packages/uni-app-plus-nvue/dist/index.legacy.js
浏览文件 @
adcfdfd2
...
...
@@ -122,7 +122,7 @@ function invokeApi (method, api, options, ...params) {
}
const
SYNC_API_RE
=
/^
\$
|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64/
;
/^
\$
|
getMenuButtonBoundingClientRect|
^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64/
;
const
CONTEXT_API_RE
=
/^create|Manager$/
;
...
...
src/platforms/app-plus-nvue/service/api/route/navigate-back.js
浏览文件 @
adcfdfd2
...
...
@@ -74,16 +74,28 @@ function back (delta, animationType, animationDuration) {
}
export
function
navigateBack
({
from
=
'
navigateBack
'
,
delta
,
animationType
,
animationDuration
})
{
const
pages
=
getCurrentPages
()
const
len
=
pages
.
length
const
currentPage
=
pages
[
pages
.
length
-
1
]
if
(
currentPage
.
$vm
&&
currentPage
.
$vm
.
$options
.
onBackPress
&&
currentPage
.
$vm
.
__call_hook
&&
currentPage
.
$vm
.
__call_hook
(
'
onBackPress
'
,
{
from
})
)
{
return
}
uni
.
hideToast
()
// 后退时,关闭 toast,loading
pages
[
len
-
1
]
.
$page
.
meta
.
isQuit
currentPage
.
$page
.
meta
.
isQuit
?
quit
()
:
back
(
delta
,
animationType
,
animationDuration
)
}
src/platforms/app-plus/service/bridge.js
浏览文件 @
adcfdfd2
...
...
@@ -57,7 +57,8 @@ export function isTabBarPage (path = '') {
}
return
page
.
$page
.
meta
.
isTabBar
}
return
!!
__uniRoutes
.
find
(
route
=>
route
.
path
.
slice
(
1
)
===
path
)
const
route
=
__uniRoutes
.
find
(
route
=>
route
.
path
.
slice
(
1
)
===
path
)
return
route
&&
route
.
meta
.
isTabBar
}
catch
(
e
)
{
if
(
process
.
env
.
NODE_ENV
!==
'
production
'
)
{
console
.
log
(
'
getCurrentPages is not ready
'
)
...
...
src/platforms/app-plus/service/framework/app.js
浏览文件 @
adcfdfd2
...
...
@@ -43,7 +43,6 @@ function initGlobalListeners () {
const
emit
=
UniServiceJSBridge
.
emit
plus
.
key
.
addEventListener
(
'
backbutton
'
,
()
=>
{
// TODO uni?
uni
.
navigateBack
({
from
:
'
backbutton
'
})
...
...
@@ -98,10 +97,12 @@ function initTabBar () {
return
}
const
currentTab
=
isTabBarPage
(
__uniConfig
.
entryPagePath
)
if
(
currentTab
)
{
__uniConfig
.
tabBar
.
selected
=
0
const
selected
=
__uniConfig
.
tabBar
.
list
.
findIndex
(
page
=>
page
.
pagePath
===
__uniConfig
.
entryPagePath
)
if
(
selected
!==
-
1
)
{
// 取当前 tab 索引值
__uniConfig
.
tabBar
.
selected
=
__uniConfig
.
tabBar
.
list
.
indexOf
(
currentTab
)
__uniConfig
.
tabBar
.
selected
=
selected
// 如果真实的首页与 condition 都是 tabbar,无需启用 realEntryPagePath 机制
if
(
__uniConfig
.
realEntryPagePath
&&
isTabBarPage
(
__uniConfig
.
realEntryPagePath
))
{
delete
__uniConfig
.
realEntryPagePath
...
...
@@ -111,7 +112,12 @@ function initTabBar () {
__uniConfig
.
__ready__
=
true
const
onLaunchWebviewReady
=
function
onLaunchWebviewReady
()
{
const
tabBarView
=
tabBar
.
init
(
__uniConfig
.
tabBar
,
(
item
)
=>
{
const
tabBarView
=
tabBar
.
init
(
__uniConfig
.
tabBar
,
(
item
,
index
)
=>
{
UniServiceJSBridge
.
emit
(
'
onTabItemTap
'
,
{
index
,
text
:
item
.
text
,
pagePath
:
item
.
pagePath
})
uni
.
switchTab
({
url
:
'
/
'
+
item
.
pagePath
,
openType
:
'
switchTab
'
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录