Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Velpro187
uni-app
提交
5516ac15
U
uni-app
项目概览
Velpro187
/
uni-app
与 Fork 源项目一致
Fork自
DCloud / uni-app
通知
1
Star
1
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,发现更多精彩内容 >>
提交
5516ac15
编写于
2月 18, 2022
作者:
fxy060608
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
wip(app): nvue
上级
8e53f46d
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
58 addition
and
29 deletion
+58
-29
packages/uni-app-plus/dist/uni.runtime.esm.js
packages/uni-app-plus/dist/uni.runtime.esm.js
+28
-13
packages/uni-app-plus/src/service/framework/page/getCurrentPages.ts
...ni-app-plus/src/service/framework/page/getCurrentPages.ts
+11
-1
packages/uni-app-plus/src/service/framework/page/register.ts
packages/uni-app-plus/src/service/framework/page/register.ts
+19
-15
未找到文件。
packages/uni-app-plus/dist/uni.runtime.esm.js
浏览文件 @
5516ac15
...
...
@@ -16848,7 +16848,18 @@ function initVueApp(appVm) {
const pages = [];
function addCurrentPage(page) {
pages.push(page);
const $page = page.$page;
if (!$page.meta.isNVue) {
return pages.push(page);
}
// 开发阶段热刷新需要移除旧的相同 id 的 page
const index = pages.findIndex((page) => page.$page.id === page.$page.id);
if (index > -1) {
pages.splice(index, 1, page);
}
else {
pages.push(page);
}
}
function getPageById(id) {
return pages.find((page) => page.$page.id === id);
...
...
@@ -18193,15 +18204,17 @@ function registerPage({ url, path, query, openType, webview, nvuePageVm, eventCh
console.log(formatLog('registerPage', path, webview.id));
}
initWebview(webview, path, query, routeOptions.meta);
const route = path.s
ubstr
(1);
const route = path.s
lice
(1);
webview.__uniapp_route = route;
const pageInstance = initPageInternalInstance(openType, url, query, routeOptions.meta, eventChannel);
const id = parseInt(webview.id);
if (webview.nvue) {
if (id === 1 && nvuePageVm) {
initNVueEntryPage(webview, nvuePageVm, pageInstance);
if (nvuePageVm) {
// 首页或者开发时热刷
initNVuePage(id, nvuePageVm, pageInstance);
}
else {
// 正常路由跳转
createNVuePage(id, webview, pageInstance);
}
}
...
...
@@ -18232,18 +18245,20 @@ function initPageOptions({ meta }) {
windowBottom: tabBarInstance.indexOf(meta.route) >= 0 && tabBarInstance.cover ? tabBarInstance.height : 0,
};
}
function initNVue
EntryPage(webview
, nvuePageVm, pageInstance) {
function initNVue
Page(id
, nvuePageVm, pageInstance) {
initPageVm(nvuePageVm, pageInstance);
addCurrentPage(nvuePageVm);
// 首页是 nvue 时,在 registerPage 时,执行路由堆栈
if (__uniConfig.splashscreen &&
__uniConfig.splashscreen.autoclose &&
!__uniConfig.splashscreen.alwaysShowBeforeRender) {
plus.navigator.closeSplashscreen();
if (id === 1) {
// 首页是 nvue 时,在 registerPage 时,执行路由堆栈
if (__uniConfig.splashscreen &&
__uniConfig.splashscreen.autoclose &&
!__uniConfig.splashscreen.alwaysShowBeforeRender) {
plus.navigator.closeSplashscreen();
}
__uniConfig.onReady(function () {
navigateFinish();
});
}
__uniConfig.onReady(function () {
navigateFinish();
});
}
function createNVuePage(pageId, webview, pageInstance) {
const fakeNVueVm = {
...
...
packages/uni-app-plus/src/service/framework/page/getCurrentPages.ts
浏览文件 @
5516ac15
...
...
@@ -6,7 +6,17 @@ import { getVueApp } from '../app/vueApp'
const
pages
:
ComponentPublicInstance
[]
=
[]
export
function
addCurrentPage
(
page
:
ComponentPublicInstance
)
{
pages
.
push
(
page
)
const
$page
=
page
.
$page
if
(
!
$page
.
meta
.
isNVue
)
{
return
pages
.
push
(
page
)
}
// 开发阶段热刷新需要移除旧的相同 id 的 page
const
index
=
pages
.
findIndex
((
page
)
=>
page
.
$page
.
id
===
page
.
$page
.
id
)
if
(
index
>
-
1
)
{
pages
.
splice
(
index
,
1
,
page
)
}
else
{
pages
.
push
(
page
)
}
}
export
function
getPageById
(
id
:
number
)
{
...
...
packages/uni-app-plus/src/service/framework/page/register.ts
浏览文件 @
5516ac15
...
...
@@ -96,7 +96,7 @@ export function registerPage({
initWebview
(
webview
,
path
,
query
,
routeOptions
.
meta
)
const
route
=
path
.
s
ubstr
(
1
)
const
route
=
path
.
s
lice
(
1
)
;(
webview
as
any
).
__uniapp_route
=
route
const
pageInstance
=
initPageInternalInstance
(
...
...
@@ -110,9 +110,11 @@ export function registerPage({
const
id
=
parseInt
(
webview
.
id
!
)
if
((
webview
as
any
).
nvue
)
{
if
(
id
===
1
&&
nvuePageVm
)
{
initNVueEntryPage
(
webview
,
nvuePageVm
,
pageInstance
)
if
(
nvuePageVm
)
{
// 首页或者开发时热刷
initNVuePage
(
id
,
nvuePageVm
,
pageInstance
)
}
else
{
// 正常路由跳转
createNVuePage
(
id
,
webview
,
pageInstance
)
}
}
else
{
...
...
@@ -146,24 +148,26 @@ function initPageOptions({ meta }: UniApp.UniRoute): PageNodeOptions {
}
}
function
initNVue
Entry
Page
(
webview
:
PlusWebviewWebviewObject
,
function
initNVuePage
(
id
:
number
,
nvuePageVm
:
ComponentPublicInstance
,
pageInstance
:
Page
.
PageInstance
[
'
$page
'
]
)
{
initPageVm
(
nvuePageVm
,
pageInstance
)
addCurrentPage
(
nvuePageVm
)
// 首页是 nvue 时,在 registerPage 时,执行路由堆栈
if
(
__uniConfig
.
splashscreen
&&
__uniConfig
.
splashscreen
.
autoclose
&&
!
__uniConfig
.
splashscreen
.
alwaysShowBeforeRender
)
{
plus
.
navigator
.
closeSplashscreen
()
if
(
id
===
1
)
{
// 首页是 nvue 时,在 registerPage 时,执行路由堆栈
if
(
__uniConfig
.
splashscreen
&&
__uniConfig
.
splashscreen
.
autoclose
&&
!
__uniConfig
.
splashscreen
.
alwaysShowBeforeRender
)
{
plus
.
navigator
.
closeSplashscreen
()
}
__uniConfig
.
onReady
(
function
()
{
navigateFinish
()
})
}
__uniConfig
.
onReady
(
function
()
{
navigateFinish
()
})
}
function
createNVuePage
(
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录