Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
r15132706585
uni-app
提交
5395dfdb
U
uni-app
项目概览
r15132706585
/
uni-app
与 Fork 源项目一致
Fork自
DCloud / uni-app
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-app
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
5395dfdb
编写于
10月 13, 2020
作者:
fxy060608
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(app-plus): launch nvue page
上级
8d72f46d
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
78 addition
and
58 deletion
+78
-58
src/platforms/app-plus/service/framework/app.js
src/platforms/app-plus/service/framework/app.js
+16
-56
src/platforms/app-plus/service/framework/config.js
src/platforms/app-plus/service/framework/config.js
+52
-1
src/platforms/app-plus/service/framework/page.js
src/platforms/app-plus/service/framework/page.js
+10
-1
未找到文件。
src/platforms/app-plus/service/framework/app.js
浏览文件 @
5395dfdb
...
...
@@ -10,6 +10,10 @@ import {
TEMP_PATH_BASE
}
from
'
../api/constants
'
import
{
initEntryPage
}
from
'
./config
'
import
{
getCurrentPages
}
from
'
./page
'
...
...
@@ -95,17 +99,17 @@ function initGlobalListeners () {
})
})
globalEvent
.
addEventListener
(
'
uistylechange
'
,
function
(
event
)
{
const
args
=
{
theme
:
event
.
uistyle
}
callAppHook
(
appCtx
,
'
onThemeChange
'
,
args
)
publish
(
'
onThemeChange
'
,
args
)
// 兼容旧版本 API
publish
(
'
onUIStyleChange
'
,
{
style
:
event
.
uistyle
globalEvent
.
addEventListener
(
'
uistylechange
'
,
function
(
event
)
{
const
args
=
{
theme
:
event
.
uistyle
}
callAppHook
(
appCtx
,
'
onThemeChange
'
,
args
)
publish
(
'
onThemeChange
'
,
args
)
// 兼容旧版本 API
publish
(
'
onUIStyleChange
'
,
{
style
:
event
.
uistyle
})
})
...
...
@@ -171,50 +175,6 @@ function initTabBar () {
}
}
function
initEntryPage
()
{
let
entryPagePath
let
entryPageQuery
const
weexPlus
=
weex
.
requireModule
(
'
plus
'
)
if
(
weexPlus
.
getRedirectInfo
)
{
const
info
=
weexPlus
.
getRedirectInfo
()
||
{}
entryPagePath
=
info
.
path
entryPageQuery
=
info
.
query
?
(
'
?
'
+
info
.
query
)
:
''
}
else
{
const
argsJsonStr
=
plus
.
runtime
.
arguments
if
(
!
argsJsonStr
)
{
return
}
try
{
const
args
=
JSON
.
parse
(
argsJsonStr
)
entryPagePath
=
args
.
path
||
args
.
pathName
entryPageQuery
=
args
.
query
?
(
'
?
'
+
args
.
query
)
:
''
}
catch
(
e
)
{}
}
if
(
!
entryPagePath
||
entryPagePath
===
__uniConfig
.
entryPagePath
)
{
return
}
const
entryRoute
=
'
/
'
+
entryPagePath
const
routeOptions
=
__uniRoutes
.
find
(
route
=>
route
.
path
===
entryRoute
)
if
(
!
routeOptions
)
{
return
}
if
(
!
routeOptions
.
meta
.
isTabBar
)
{
__uniConfig
.
realEntryPagePath
=
__uniConfig
.
realEntryPagePath
||
__uniConfig
.
entryPagePath
}
__uniConfig
.
entryPagePath
=
entryPagePath
__uniConfig
.
entryPageQuery
=
entryPageQuery
if
(
process
.
env
.
NODE_ENV
!==
'
production
'
)
{
console
.
log
(
`[uni-app] entryPagePath(
${
entryPagePath
+
entryPageQuery
}
)`
)
}
}
export
function
clearTempFile
()
{
// 统一处理路径
function
getPath
(
path
)
{
...
...
@@ -277,4 +237,4 @@ export function registerApp (appVm) {
__uniConfig
.
ready
=
true
process
.
env
.
NODE_ENV
!==
'
production
'
&&
perf
(
'
registerApp
'
)
}
}
src/platforms/app-plus/service/framework/config.js
浏览文件 @
5395dfdb
...
...
@@ -19,7 +19,7 @@ function parseRoutes (config) {
})
}
export
function
registerConfig
(
config
,
Vue
)
{
export
function
registerConfig
(
config
,
Vue
)
{
Object
.
assign
(
__uniConfig
,
config
)
__uniConfig
.
viewport
=
''
...
...
@@ -35,4 +35,55 @@ export function registerConfig (config, Vue) {
if
(
process
.
env
.
NODE_ENV
!==
'
production
'
)
{
console
.
log
(
'
[uni-app] registerConfig
'
,
__uniConfig
)
}
}
let
isInitEntryPage
=
false
export
function
initEntryPage
()
{
if
(
isInitEntryPage
)
{
return
}
isInitEntryPage
=
true
let
entryPagePath
let
entryPageQuery
const
weexPlus
=
weex
.
requireModule
(
'
plus
'
)
if
(
weexPlus
.
getRedirectInfo
)
{
const
info
=
weexPlus
.
getRedirectInfo
()
||
{}
entryPagePath
=
info
.
path
entryPageQuery
=
info
.
query
?
(
'
?
'
+
info
.
query
)
:
''
}
else
{
const
argsJsonStr
=
plus
.
runtime
.
arguments
if
(
!
argsJsonStr
)
{
return
}
try
{
const
args
=
JSON
.
parse
(
argsJsonStr
)
entryPagePath
=
args
.
path
||
args
.
pathName
entryPageQuery
=
args
.
query
?
(
'
?
'
+
args
.
query
)
:
''
}
catch
(
e
)
{}
}
if
(
!
entryPagePath
||
entryPagePath
===
__uniConfig
.
entryPagePath
)
{
return
}
const
entryRoute
=
'
/
'
+
entryPagePath
const
routeOptions
=
__uniRoutes
.
find
(
route
=>
route
.
path
===
entryRoute
)
if
(
!
routeOptions
)
{
return
}
if
(
!
routeOptions
.
meta
.
isTabBar
)
{
__uniConfig
.
realEntryPagePath
=
__uniConfig
.
realEntryPagePath
||
__uniConfig
.
entryPagePath
}
__uniConfig
.
entryPagePath
=
entryPagePath
__uniConfig
.
entryPageQuery
=
entryPageQuery
if
(
process
.
env
.
NODE_ENV
!==
'
production
'
)
{
console
.
log
(
`[uni-app] entryPagePath(
${
entryPagePath
+
entryPageQuery
}
)`
)
}
}
src/platforms/app-plus/service/framework/page.js
浏览文件 @
5395dfdb
...
...
@@ -17,6 +17,10 @@ import {
loadPage
}
from
'
./load-sub-package
'
import
{
initEntryPage
}
from
'
./config
'
const
pages
=
[]
export
function
getCurrentPages
(
returnAll
)
{
...
...
@@ -83,6 +87,9 @@ export function registerPage ({
webview
,
eventChannel
})
{
// fast 模式,nvue 首页时,初始化下 entry page
webview
&&
initEntryPage
()
if
(
preloadWebviews
[
url
])
{
webview
=
preloadWebviews
[
url
]
if
(
webview
.
__page__
)
{
...
...
@@ -137,6 +144,8 @@ export function registerPage ({
console
.
log
(
`[uni-app] registerPage(
${
path
}
,
${
webview
.
id
}
)`
)
}
const
isLaunchNVuePage
=
webview
.
id
===
'
1
'
&&
webview
.
nvue
initWebview
(
webview
,
routeOptions
,
path
,
query
)
const
route
=
path
.
slice
(
1
)
...
...
@@ -188,7 +197,7 @@ export function registerPage ({
}
// 首页是 nvue 时,在 registerPage 时,执行路由堆栈
if
(
webview
.
id
===
'
1
'
&&
webview
.
nvu
e
)
{
if
(
isLaunchNVuePag
e
)
{
if
(
__uniConfig
.
splashscreen
&&
__uniConfig
.
splashscreen
.
autoclose
&&
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录