Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Velpro187
uni-app
提交
cf148611
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,发现更多精彩内容 >>
提交
cf148611
编写于
12月 24, 2019
作者:
fxy060608
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat(v3): hot reload
上级
78c79a17
变更
7
展开全部
隐藏空白更改
内联
并排
Showing
7 changed file
with
148 addition
and
122 deletion
+148
-122
packages/uni-app-plus/dist/index.v3.js
packages/uni-app-plus/dist/index.v3.js
+76
-102
packages/webpack-uni-pages-loader/lib/platforms/app-plus/index.v3.js
...bpack-uni-pages-loader/lib/platforms/app-plus/index.v3.js
+19
-5
src/platforms/app-plus/service/api/route/navigate-back.js
src/platforms/app-plus/service/api/route/navigate-back.js
+5
-5
src/platforms/app-plus/service/framework/app.js
src/platforms/app-plus/service/framework/app.js
+31
-2
src/platforms/app-plus/service/framework/page.js
src/platforms/app-plus/service/framework/page.js
+7
-2
src/platforms/app-plus/service/framework/webview/parser/webview-style-parser.js
.../service/framework/webview/parser/webview-style-parser.js
+8
-4
src/platforms/mp-alipay/runtime/wrapper/page-parser.js
src/platforms/mp-alipay/runtime/wrapper/page-parser.js
+2
-2
未找到文件。
packages/uni-app-plus/dist/index.v3.js
浏览文件 @
cf148611
此差异已折叠。
点击以展开。
packages/webpack-uni-pages-loader/lib/platforms/app-plus/index.v3.js
浏览文件 @
cf148611
...
...
@@ -16,15 +16,28 @@ const {
const
definePages
=
require
(
'
./define-pages
'
)
const
appConfigService
=
require
(
'
./app-config-service
'
)
function
getTabBarPages
(
appJson
)
{
return
appJson
.
tabBar
&&
appJson
.
tabBar
.
list
&&
appJson
.
tabBar
.
list
.
length
&&
appJson
.
tabBar
.
list
}
function
isTabBarPage
(
pathName
,
tabBarPages
)
{
return
tabBarPages
.
find
(
item
=>
item
.
pagePath
===
pathName
)
}
function
parseEntryPagePath
(
appJson
,
manifestJson
)
{
const
argsJsonStr
=
manifestJson
.
plus
.
arguments
if
(
argsJsonStr
)
{
try
{
const
args
=
JSON
.
parse
(
argsJsonStr
)
const
pathName
=
args
.
path
||
args
.
pathName
if
(
pathName
&&
pathName
!==
appJson
.
pages
[
0
]
)
{
if
(
pathName
&&
appJson
.
pages
[
0
]
!==
pathName
)
{
appJson
.
entryPagePath
=
pathName
appJson
.
realEntryPagePath
=
appJson
.
pages
[
0
]
if
(
!
isTabBarPage
(
pathName
,
getTabBarPages
(
appJson
)))
{
appJson
.
realEntryPagePath
=
appJson
.
pages
[
0
]
}
}
}
catch
(
e
)
{}
}
...
...
@@ -32,12 +45,13 @@ function parseEntryPagePath (appJson, manifestJson) {
appJson
.
entryPagePath
=
appJson
.
pages
[
0
]
}
}
module
.
exports
=
function
(
appJson
,
manifestJson
,
{
pagesJson
,
manifest
,
normalizeNetworkTimeout
})
{
parseEntryPagePath
(
appJson
,
manifestJson
)
})
{
parseEntryPagePath
(
appJson
,
manifestJson
)
// timeout
normalizeNetworkTimeout
(
appJson
)
...
...
@@ -61,7 +75,7 @@ module.exports = function (appJson, manifestJson, {
manifestJson
.
permissions
.
UniNView
=
{
'
description
'
:
'
UniNView原生渲染
'
}
// TODO 需要考虑 condition
manifestJson
.
plus
.
launchwebview
.
id
=
'
1
'
// 首页 id 固定 为 1
// 删除首页 style 中的 uni-app 配置(不注入 app-view.js)
delete
manifestJson
.
plus
.
launchwebview
[
'
uni-app
'
]
...
...
src/platforms/app-plus/service/api/route/navigate-back.js
浏览文件 @
cf148611
...
...
@@ -100,15 +100,15 @@ export function navigateBack ({
uni
.
hideToast
()
// 后退时,关闭 toast,loading
// 当前页面是 condition 进入
if
(
currentPage
.
$page
.
id
===
1
&&
__uniConfig
.
realEntryPagePath
)
{
if
(
currentPage
.
$page
.
meta
.
isQuit
)
{
quit
()
}
else
if
(
currentPage
.
$page
.
id
===
1
&&
__uniConfig
.
realEntryPagePath
)
{
// condition
uni
.
reLaunch
({
url
:
'
/
'
+
__uniConfig
.
realEntryPagePath
})
}
else
{
currentPage
.
$page
.
meta
.
isQuit
?
quit
()
:
back
(
delta
,
animationType
,
animationDuration
)
back
(
delta
,
animationType
,
animationDuration
)
}
return
{
errMsg
:
'
navigateBack:ok
'
...
...
src/platforms/app-plus/service/framework/app.js
浏览文件 @
cf148611
...
...
@@ -49,7 +49,9 @@ export function getApp ({
if
(
allowDefault
)
{
// 返回默认实现
return
defaultApp
}
console
.
error
(
'
[warn]: getApp() 操作失败,v3模式加速了首页 nvue 的启动速度,当在首页 nvue 中使用 getApp() 不一定可以获取真正的 App 对象。详情请参考:https://uniapp.dcloud.io/collocation/frame/window?id=getapp
'
)
console
.
error
(
'
[warn]: getApp() 操作失败,v3模式加速了首页 nvue 的启动速度,当在首页 nvue 中使用 getApp() 不一定可以获取真正的 App 对象。详情请参考:https://uniapp.dcloud.io/collocation/frame/window?id=getapp
'
)
}
function
initGlobalListeners
()
{
...
...
@@ -138,6 +140,31 @@ function initTabBar () {
})
}
function
initHotReload
()
{
const
reloadUrl
=
weex
.
config
.
reloadUrl
if
(
!
reloadUrl
)
{
return
}
if
(
reloadUrl
===
__uniConfig
.
entryPagePath
)
{
return
}
const
reloadPath
=
'
/
'
+
reloadUrl
const
routeOptions
=
__uniRoutes
.
find
(
route
=>
route
.
path
===
reloadPath
)
if
(
!
routeOptions
)
{
return
}
if
(
routeOptions
.
meta
.
isNVue
)
{
// 暂不处理 nvue
return
}
if
(
!
routeOptions
.
meta
.
isTabBar
)
{
__uniConfig
.
realEntryPagePath
=
__uniConfig
.
realEntryPagePath
||
__uniConfig
.
entryPagePath
}
__uniConfig
.
entryPagePath
=
reloadUrl
if
(
process
.
env
.
NODE_ENV
!==
'
production
'
)
{
console
.
log
(
`[uni-app] reloadUrl(
${
reloadUrl
}
)`
)
}
}
export
function
registerApp
(
appVm
)
{
if
(
process
.
env
.
NODE_ENV
!==
'
production
'
)
{
console
.
log
(
`[uni-app] registerApp`
)
...
...
@@ -156,6 +183,8 @@ export function registerApp (appVm) {
getCurrentPages
})
initHotReload
()
initTabBar
()
initGlobalListeners
()
...
...
@@ -167,4 +196,4 @@ export function registerApp (appVm) {
__uniConfig
.
ready
=
true
process
.
env
.
NODE_ENV
!==
'
production
'
&&
perf
(
'
registerApp
'
)
}
}
src/platforms/app-plus/service/framework/page.js
浏览文件 @
cf148611
...
...
@@ -32,8 +32,13 @@ export function registerPage ({
})
{
const
routeOptions
=
JSON
.
parse
(
JSON
.
stringify
(
__uniRoutes
.
find
(
route
=>
route
.
path
===
path
)))
if
(
openType
===
'
reLaunch
'
||
pages
.
length
===
0
)
{
// pages.length===0 表示首页触发 redirectTo
if
(
openType
===
'
reLaunch
'
||
(
openType
===
'
redirect
'
&&
pages
.
length
===
0
)
// 首页 redirect
)
{
routeOptions
.
meta
.
isQuit
=
true
}
else
if
(
!
routeOptions
.
meta
.
isTabBar
)
{
routeOptions
.
meta
.
isQuit
=
false
...
...
src/platforms/app-plus/service/framework/webview/parser/webview-style-parser.js
浏览文件 @
cf148611
...
...
@@ -4,8 +4,8 @@ import {
import
{
parsePullToRefresh
}
from
'
./pull-to-refresh-parser
'
}
from
'
./pull-to-refresh-parser
'
import
{
parseStyleUnit
}
from
'
./style-unit-parser
'
...
...
@@ -44,7 +44,11 @@ export function parseWebviewStyle (id, path, routeOptions = {}) {
const
titleNView
=
parseTitleNView
(
routeOptions
)
if
(
titleNView
)
{
if
(
id
===
1
&&
__uniConfig
.
realEntryPagePath
)
{
if
(
id
===
1
&&
__uniConfig
.
realEntryPagePath
&&
!
routeOptions
.
meta
.
isQuit
// 可能是tabBar
)
{
titleNView
.
autoBackButton
=
true
}
webviewStyle
.
titleNView
=
titleNView
...
...
@@ -74,4 +78,4 @@ export function parseWebviewStyle (id, path, routeOptions = {}) {
}
return
webviewStyle
}
}
src/platforms/mp-alipay/runtime/wrapper/page-parser.js
浏览文件 @
cf148611
...
...
@@ -67,8 +67,8 @@ export default function parsePage (vuePageOptions) {
},
events
:
{
// 支付宝小程序有些页面事件只能放在events下
onBack
()
{
this
.
$vm
.
__call_hook
(
'
onBackPress
'
);
onBack
()
{
this
.
$vm
.
__call_hook
(
'
onBackPress
'
)
}
},
__r
:
handleRef
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录