Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
uni-app
提交
555262a2
U
uni-app
项目概览
DCloud
/
uni-app
2 个月 前同步成功
通知
718
Star
38705
Fork
3642
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
7
列表
看板
标记
里程碑
合并请求
1
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-app
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
7
Issue
7
列表
看板
标记
里程碑
合并请求
1
合并请求
1
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
555262a2
编写于
11月 01, 2019
作者:
雪洛
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update: lint & 精简代码
上级
e39764aa
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
17 addition
and
26 deletion
+17
-26
src/platforms/app-plus/service/framework/webview/index.js
src/platforms/app-plus/service/framework/webview/index.js
+6
-9
src/platforms/app-plus/service/framework/webview/parser/style-unit-parser.js
...lus/service/framework/webview/parser/style-unit-parser.js
+1
-1
src/platforms/app-plus/service/framework/webview/parser/sub-nvue-parser.js
...-plus/service/framework/webview/parser/sub-nvue-parser.js
+10
-16
未找到文件。
src/platforms/app-plus/service/framework/webview/index.js
浏览文件 @
555262a2
...
...
@@ -128,8 +128,7 @@ export function initWebview (webview, routeOptions) {
emit
}
=
UniServiceJSBridge
// TODO subNVues
initSubNVues
(
routeOptions
,
webview
)
initSubNVues
(
routeOptions
,
webview
)
// TODO 优化相关依赖性
// webview.addEventListener('popGesture', e => {
...
...
@@ -154,17 +153,16 @@ export function initWebview (webview, routeOptions) {
// })
webview
.
addEventListener
(
'
close
'
,
()
=>
{
if
(
this
.
popupSubNVueWebviews
)
{
// 移除所有 popupSubNVueWebview
Object
.
keys
(
this
.
popupSubNVueWebviews
).
forEach
(
id
=>
{
if
(
webview
.
popupSubNVueWebviews
)
{
// 移除所有 popupSubNVueWebview
Object
.
keys
(
webview
.
popupSubNVueWebviews
).
forEach
(
id
=>
{
if
(
process
.
env
.
NODE_ENV
!==
'
production
'
)
{
console
.
log
(
`UNIAPP[webview][
${
this
.
id
}
]:popupSubNVueWebview[
${
id
}
].close`
`UNIAPP[webview][
${
webview
.
id
}
]:popupSubNVueWebview[
${
id
}
].close`
)
}
this
.
popupSubNVueWebviews
[
id
].
close
(
'
none
'
)
webview
.
popupSubNVueWebviews
[
id
].
close
(
'
none
'
)
})
}
typeof
this
.
closeCallback
===
'
function
'
&&
this
.
closeCallback
()
})
Object
.
keys
(
WEBVIEW_LISTENERS
).
forEach
(
name
=>
{
...
...
@@ -179,7 +177,6 @@ export function initWebview (webview, routeOptions) {
onWebviewRecovery
(
webview
,
routeOptions
)
}
// TODO 应该结束之前未完成的下拉刷新
on
(
webview
.
id
+
'
.startPullDownRefresh
'
,
()
=>
{
webview
.
beginPullToRefresh
()
})
...
...
src/platforms/app-plus/service/framework/webview/parser/style-unit-parser.js
浏览文件 @
555262a2
...
...
@@ -2,7 +2,7 @@ import {
transformCSS
}
from
'
../../upx
'
export
function
parseStyleUnit
(
styles
)
{
export
function
parseStyleUnit
(
styles
)
{
let
newStyles
=
{}
const
stylesStr
=
JSON
.
stringify
(
styles
)
if
(
~
stylesStr
.
indexOf
(
'
upx
'
)
||
~
stylesStr
.
indexOf
(
'
rpx
'
))
{
...
...
src/platforms/app-plus/service/framework/webview/parser/sub-nvue-parser.js
浏览文件 @
555262a2
...
...
@@ -10,15 +10,9 @@ import {
isTabBarPage
}
from
'
../../../bridge
'
function
getDefaultFontSize
(
width
)
{
return
Math
.
round
((
width
||
plus
.
screen
.
resolutionWidth
)
/
20
)
}
function
getDefaultViewport
()
{
return
plus
.
screen
.
resolutionWidth
}
import
tabBar
from
'
../../tab-bar
'
function
initPopupSubNVue
(
subNVueWebview
,
style
,
maskWebview
)
{
function
initPopupSubNVue
(
subNVueWebview
,
style
,
maskWebview
)
{
if
(
!
maskWebview
.
popupSubNVueWebviews
)
{
maskWebview
.
popupSubNVueWebviews
=
{}
}
...
...
@@ -63,15 +57,15 @@ function initPopupSubNVue(subNVueWebview, style, maskWebview) {
})
}
function
initNormalSubNVue
(
subNVueWebview
,
style
,
webview
)
{
function
initNormalSubNVue
(
subNVueWebview
,
style
,
webview
)
{
webview
.
append
(
subNVueWebview
)
}
function
initSubNVue
(
subNVue
,
routeOptions
,
webview
)
{
function
initSubNVue
(
subNVue
,
routeOptions
,
webview
)
{
if
(
!
subNVue
.
path
)
{
return
}
const
style
=
subNVue
.
style
||
{}
// 格式化
const
style
=
subNVue
.
style
||
{}
const
isNavigationBar
=
subNVue
.
type
===
'
navigationBar
'
const
isPopup
=
subNVue
.
type
===
'
popup
'
...
...
@@ -84,8 +78,8 @@ function initSubNVue(subNVue,routeOptions,webview) {
style
.
uniNView
=
{
path
:
subNVue
.
path
.
replace
(
'
.nvue
'
,
'
.js
'
),
defaultFontSize
:
getDefaultFontSize
()
,
viewport
:
getDefaultViewport
()
defaultFontSize
:
__uniConfig
.
defaultFontSize
,
viewport
:
__uniConfig
.
viewport
}
const
extras
=
{
...
...
@@ -109,7 +103,7 @@ function initSubNVue(subNVue,routeOptions,webview) {
delete
style
.
margin
}
else
if
(
isPopup
)
{
style
.
position
=
'
absolute
'
console
.
log
(
isTabBarPage
(
routeOptions
.
path
))
;
console
.
log
(
isTabBarPage
(
routeOptions
.
path
))
if
(
isTabBarPage
(
routeOptions
.
path
))
{
maskWebview
=
tabBar
}
else
{
...
...
@@ -133,12 +127,12 @@ function initSubNVue(subNVue,routeOptions,webview) {
}
}
export
function
initSubNVues
(
routeOptions
,
webview
)
{
export
function
initSubNVues
(
routeOptions
,
webview
)
{
const
subNVues
=
routeOptions
.
window
.
subNVues
if
(
!
subNVues
||
!
subNVues
.
length
)
{
return
}
subNVues
.
forEach
(
subNVue
=>
{
initSubNVue
(
subNVue
,
routeOptions
,
webview
)
initSubNVue
(
subNVue
,
routeOptions
,
webview
)
})
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录