Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
uni-app
提交
33679d5d
U
uni-app
项目概览
DCloud
/
uni-app
4 个月 前同步成功
通知
730
Star
38706
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,发现更多精彩内容 >>
提交
33679d5d
编写于
7月 18, 2019
作者:
fxy060608
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat(app-plus-nvue): refactor route
上级
2d30a925
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
344 addition
and
101 deletion
+344
-101
packages/uni-app-plus-nvue/dist/index.js
packages/uni-app-plus-nvue/dist/index.js
+214
-46
src/core/service/plugins/util.js
src/core/service/plugins/util.js
+3
-3
src/platforms/app-plus-nvue/service/uni/router/navigate-back.js
...atforms/app-plus-nvue/service/uni/router/navigate-back.js
+1
-1
src/platforms/app-plus-nvue/service/uni/router/navigate-to.js
...platforms/app-plus-nvue/service/uni/router/navigate-to.js
+9
-20
src/platforms/app-plus-nvue/service/uni/router/util.js
src/platforms/app-plus-nvue/service/uni/router/util.js
+0
-20
src/platforms/app-plus-nvue/service/uni/router/webview.js
src/platforms/app-plus-nvue/service/uni/router/webview.js
+14
-0
src/platforms/app-plus/service/uni/bridge.js
src/platforms/app-plus/service/uni/bridge.js
+16
-0
src/platforms/app-plus/service/uni/config.js
src/platforms/app-plus/service/uni/config.js
+2
-1
src/platforms/app-plus/service/uni/create-instance-context.js
...platforms/app-plus/service/uni/create-instance-context.js
+12
-5
src/platforms/app-plus/service/uni/page.js
src/platforms/app-plus/service/uni/page.js
+21
-5
src/platforms/app-plus/service/uni/webview.js
src/platforms/app-plus/service/uni/webview.js
+52
-0
未找到文件。
packages/uni-app-plus-nvue/dist/index.js
浏览文件 @
33679d5d
import
{
createUniInstance
}
from
'
./uni
'
;
import
{
createUniInstance
}
from
'
./uni
'
;
const
ANI_SHOW
=
'
pop-in
'
;
const
ANI_DURATION
=
300
;
const
ANI_DURATION
=
300
;
const
ANI_SHOW
=
'
pop-in
'
;
let
id
=
0
;
function
showWebview
(
webview
,
animationType
,
animationDuration
)
{
setTimeout
(()
=>
{
function
getId
()
{
webview
.
show
(
return
id
++
animationType
||
ANI_SHOW
,
}
animationDuration
||
ANI_DURATION
,
()
=>
{
function
parseWebviewStyle
(
path
)
{
console
.
log
(
'
show.callback
'
);
return
{
}
titleNView
:
{
);
autoBackButton
:
true
,
},
50
);
titleText
:
'
titleText
'
},
uniNView
:
{
path
}
}
}
}
function
initNavigateTo
({
function
initNavigateTo
({
plus
,
__registerPage
__registerPage
})
{
})
{
return
function
navigateTo
(
path
,
{
return
function
navigateTo
(
path
,
{
animationType
,
animationType
,
animationDuration
animationDuration
})
{
})
{
const
webview
=
plus
.
webview
.
open
(
showWebview
(
''
,
__registerPage
({
String
(
getId
()),
path
parseWebviewStyle
(
path
),
}),
animationType
||
ANI_SHOW
,
animationType
,
animationDuration
||
ANI_DURATION
,
animationDuration
()
=>
{
);
console
.
log
(
'
show.callback
'
);
});
__registerPage
({
path
,
webview
});
}
}
}
}
...
@@ -139,7 +125,7 @@ class Router {
...
@@ -139,7 +125,7 @@ class Router {
let
appCtx
;
let
appCtx
;
function
getApp
()
{
function
getApp
$1
()
{
return
appCtx
return
appCtx
}
}
...
@@ -160,9 +146,62 @@ function registerApp (appVm, instanceContext) {
...
@@ -160,9 +146,62 @@ function registerApp (appVm, instanceContext) {
initListeners
(
instanceContext
);
initListeners
(
instanceContext
);
}
}
const
WEBVIEW_LISTENERS
=
[
'
close
'
,
'
resize
'
,
'
popGesture
'
,
'
pullToRefresh
'
,
'
titleNViewSearchInputChanged
'
,
'
titleNViewSearchInputConfirmed
'
,
'
titleNViewSearchInputClicked
'
];
let
id
=
1
;
function
parseWebviewStyle
(
path
,
windowOptions
=
{})
{
return
{
titleNView
:
{
autoBackButton
:
true
,
titleText
:
'
titleText
'
},
uniNView
:
{
path
}
}
}
function
parseWindowOptions
(
windowOptions
=
{},
globalWindowOptions
=
{})
{
// TODO
return
windowOptions
}
function
createWebview
(
path
,
{
plus
,
__uniConfig
},
windowOptions
)
{
return
plus
.
webview
.
create
(
''
,
String
(
id
++
),
parseWebviewStyle
(
path
,
parseWindowOptions
(
windowOptions
,
__uniConfig
.
window
)
))
}
function
initWebview
(
webview
,
{
UniJSServiceBridge
})
{
// TODO subNVues
WEBVIEW_LISTENERS
.
forEach
(
listener
=>
{
webview
.
addEventListener
(
listener
,
(
e
)
=>
{
UniJSServiceBridge
.
emit
(
listener
,
e
);
});
});
}
const
pages
=
[];
const
pages
=
[];
function
getCurrentPages
()
{
function
getCurrentPages
$1
()
{
return
pages
return
pages
}
}
/**
/**
...
@@ -183,23 +222,34 @@ function getCurrentPages () {
...
@@ -183,23 +222,34 @@ function getCurrentPages () {
*
*
*
*
*/
*/
/**
* 首页需要主动registerPage,二级页面路由跳转时registerPage
*/
function
registerPage
({
function
registerPage
({
vm
,
path
,
path
,
webview
webview
},
instanceContext
)
{
},
instanceContext
)
{
const
routeOptions
=
instanceContext
.
__uniRoutes
.
find
(
route
=>
route
.
path
===
path
);
if
(
!
webview
)
{
webview
=
createWebview
(
path
,
instanceContext
,
routeOptions
.
window
);
}
if
(
process
.
env
.
NODE_ENV
!==
'
production
'
)
{
if
(
process
.
env
.
NODE_ENV
!==
'
production
'
)
{
console
.
log
(
`[uni-app] registerPage`
,
path
,
webview
.
id
);
console
.
log
(
`[uni-app] registerPage`
,
path
,
webview
.
id
);
}
}
initWebview
(
webview
,
instanceContext
,
webview
.
id
===
'
1
'
&&
routeOptions
.
window
);
pages
.
push
({
pages
.
push
({
route
:
path
.
slice
(
1
),
route
:
path
.
slice
(
1
),
$getAppWebview
()
{
$getAppWebview
()
{
return
webview
return
webview
},
},
$meta
:
instanceContext
.
__uniRoutes
.
find
(
route
=>
route
.
path
===
path
).
meta
,
$meta
:
routeOptions
.
meta
$vm
:
vm
});
});
return
webview
}
}
const
uniConfig
=
Object
.
create
(
null
);
const
uniConfig
=
Object
.
create
(
null
);
...
@@ -231,23 +281,140 @@ function registerConfig (config) {
...
@@ -231,23 +281,140 @@ function registerConfig (config) {
parseRoutes
(
uniConfig
);
parseRoutes
(
uniConfig
);
}
}
function
callHook
(
vm
,
hook
,
params
)
{
return
(
vm
.
$vm
||
vm
).
__call_hook
(
hook
,
params
)
}
function
callAppHook
(
vm
,
hook
,
params
)
{
if
(
hook
!==
'
onError
'
)
{
console
.
debug
(
`App:
${
hook
}
have been invoked`
+
(
params
?
`
${
JSON
.
stringify
(
params
)}
`
:
''
));
}
return
(
vm
.
$vm
||
vm
).
__call_hook
(
hook
,
params
)
}
function
callPageHook
(
vm
,
hook
,
params
)
{
// hack 一下,H5 平台通知 View 层onShow,方便 View 层来切换 scroll 事件监听
if
(
__PLATFORM__
===
'
h5
'
)
{
if
(
hook
===
'
onLoad
'
)
{
vm
.
$mp
.
query
=
params
;
UniServiceJSBridge
.
publishHandler
(
'
onPageLoad
'
,
vm
,
vm
.
$page
.
id
);
}
if
(
hook
===
'
onShow
'
)
{
if
(
vm
.
$route
.
meta
.
isTabBar
&&
vm
.
$route
.
params
.
detail
)
{
UniServiceJSBridge
.
emit
(
'
onTabItemTap
'
,
vm
.
$route
.
params
.
detail
);
}
UniServiceJSBridge
.
publishHandler
(
'
onPageShow
'
,
vm
,
vm
.
$page
.
id
);
}
}
if
(
hook
!==
'
onPageScroll
'
)
{
console
.
debug
(
`
${
vm
.
$page
.
route
}
[
${
vm
.
$page
.
id
}
]:
${
hook
}
have been invoked`
);
}
return
callHook
(
vm
,
hook
,
params
)
}
function
onError
(
err
)
{
callAppHook
(
getApp
(),
'
onError
'
,
err
);
}
function
onPageNotFound
(
page
)
{
callAppHook
(
getApp
(),
'
onPageNotFound
'
,
page
);
}
function
onPullDownRefresh
(
args
,
pageId
)
{
const
page
=
getCurrentPages
().
find
(
page
=>
page
.
$page
.
id
===
pageId
);
if
(
page
)
{
callPageHook
(
page
,
'
onPullDownRefresh
'
);
}
}
function
callCurrentPageHook
(
hook
,
args
)
{
const
pages
=
getCurrentPages
();
if
(
pages
.
length
)
{
callPageHook
(
pages
[
pages
.
length
-
1
],
hook
,
args
);
}
}
function
createCallCurrentPageHook
(
hook
)
{
return
function
(
args
)
{
callCurrentPageHook
(
hook
,
args
);
}
}
function
onAppEnterBackground
()
{
callAppHook
(
getApp
(),
'
onHide
'
);
callCurrentPageHook
(
'
onHide
'
);
}
function
onAppEnterForeground
()
{
callAppHook
(
getApp
(),
'
onShow
'
);
callCurrentPageHook
(
'
onShow
'
);
}
function
onWebInvokeAppService
({
name
,
arg
},
pageId
)
{
if
(
name
===
'
postMessage
'
)
;
else
{
uni
[
name
](
arg
);
}
}
function
initOn
(
on
)
{
on
(
'
onError
'
,
onError
);
on
(
'
onPageNotFound
'
,
onPageNotFound
);
on
(
'
onAppEnterBackground
'
,
onAppEnterBackground
);
on
(
'
onAppEnterForeground
'
,
onAppEnterForeground
);
on
(
'
onPullDownRefresh
'
,
onPullDownRefresh
);
on
(
'
onTabItemTap
'
,
createCallCurrentPageHook
(
'
onTabItemTap
'
));
on
(
'
onNavigationBarButtonTap
'
,
createCallCurrentPageHook
(
'
onNavigationBarButtonTap
'
));
on
(
'
onNavigationBarSearchInputChanged
'
,
createCallCurrentPageHook
(
'
onNavigationBarSearchInputChanged
'
));
on
(
'
onNavigationBarSearchInputConfirmed
'
,
createCallCurrentPageHook
(
'
onNavigationBarSearchInputConfirmed
'
));
on
(
'
onNavigationBarSearchInputClicked
'
,
createCallCurrentPageHook
(
'
onNavigationBarSearchInputClicked
'
));
on
(
'
onWebInvokeAppService
'
,
onWebInvokeAppService
);
}
function
initServiceJSBridge
(
Vue
)
{
const
Emitter
=
new
Vue
();
const
bridge
=
{
on
:
Emitter
.
$on
.
bind
(
Emitter
),
off
:
Emitter
.
$off
.
bind
(
Emitter
),
once
:
Emitter
.
$once
.
bind
(
Emitter
),
emit
:
Emitter
.
$emit
.
bind
(
Emitter
)
};
initOn
(
bridge
.
on
);
return
bridge
}
function
createInstanceContext
(
instanceContext
)
{
function
createInstanceContext
(
instanceContext
)
{
const
{
const
{
weex
,
weex
,
Vue
,
WeexPlus
WeexPlus
}
=
instanceContext
;
}
=
instanceContext
;
const
plus
=
new
WeexPlus
(
weex
);
const
plus
=
new
WeexPlus
(
weex
);
const
UniJSServiceBridge
=
initServiceJSBridge
(
Vue
);
return
{
return
{
__uniConfig
:
uniConfig
,
__uniConfig
:
uniConfig
,
__uniRoutes
:
uniRoutes
,
__uniRoutes
:
uniRoutes
,
__registerConfig
(
config
)
{
__registerConfig
(
config
)
{
re
gisterConfig
(
config
,
instanceContext
);
re
turn
registerConfig
(
config
,
instanceContext
)
},
},
__registerApp
(
appVm
)
{
__registerApp
(
appVm
)
{
re
gisterApp
(
appVm
,
instanceContext
);
re
turn
registerApp
(
appVm
,
instanceContext
)
},
},
__registerPage
(
page
)
{
__registerPage
(
page
)
{
re
gisterPage
(
page
,
instanceContext
);
re
turn
registerPage
(
page
,
instanceContext
)
},
},
plus
,
plus
,
uni
:
createUniInstance
(
uni
:
createUniInstance
(
...
@@ -255,11 +422,12 @@ function createInstanceContext (instanceContext) {
...
@@ -255,11 +422,12 @@ function createInstanceContext (instanceContext) {
plus
,
plus
,
uniConfig
,
uniConfig
,
uniRoutes
,
uniRoutes
,
getApp
,
getApp
$1
,
getCurrentPages
getCurrentPages
$1
),
),
getApp
,
getApp
:
getApp$1
,
getCurrentPages
getCurrentPages
:
getCurrentPages$1
,
UniJSServiceBridge
}
}
}
}
...
...
src/core/service/plugins/util.js
浏览文件 @
33679d5d
function
callHook
(
vm
,
hook
,
params
)
{
function
callHook
(
vm
,
hook
,
params
)
{
return
vm
.
__call_hook
(
hook
,
params
)
return
(
vm
.
$vm
||
vm
)
.
__call_hook
(
hook
,
params
)
}
}
export
function
callAppHook
(
vm
,
hook
,
params
)
{
export
function
callAppHook
(
vm
,
hook
,
params
)
{
if
(
hook
!==
'
onError
'
)
{
if
(
hook
!==
'
onError
'
)
{
console
.
debug
(
`App:
${
hook
}
have been invoked`
+
(
params
?
`
${
JSON
.
stringify
(
params
)}
`
:
''
))
console
.
debug
(
`App:
${
hook
}
have been invoked`
+
(
params
?
`
${
JSON
.
stringify
(
params
)}
`
:
''
))
}
}
return
vm
.
__call_hook
(
hook
,
params
)
return
(
vm
.
$vm
||
vm
)
.
__call_hook
(
hook
,
params
)
}
}
export
function
callPageHook
(
vm
,
hook
,
params
)
{
export
function
callPageHook
(
vm
,
hook
,
params
)
{
...
@@ -19,7 +19,7 @@ export function callPageHook (vm, hook, params) {
...
@@ -19,7 +19,7 @@ export function callPageHook (vm, hook, params) {
if
(
hook
===
'
onShow
'
)
{
if
(
hook
===
'
onShow
'
)
{
if
(
if
(
vm
.
$route
.
meta
.
isTabBar
&&
vm
.
$route
.
meta
.
isTabBar
&&
vm
.
$route
.
params
.
detail
vm
.
$route
.
params
.
detail
)
{
)
{
UniServiceJSBridge
.
emit
(
'
onTabItemTap
'
,
vm
.
$route
.
params
.
detail
)
UniServiceJSBridge
.
emit
(
'
onTabItemTap
'
,
vm
.
$route
.
params
.
detail
)
}
}
...
...
src/platforms/app-plus-nvue/service/uni/router/navigate-back.js
浏览文件 @
33679d5d
import
{
import
{
ANI_DURATION
ANI_DURATION
}
from
'
./
util
'
}
from
'
./
webview
'
let
firstBackTime
=
0
let
firstBackTime
=
0
...
...
src/platforms/app-plus-nvue/service/uni/router/navigate-to.js
浏览文件 @
33679d5d
import
{
import
{
getId
,
showWebview
ANI_SHOW
,
}
from
'
./webview
'
ANI_DURATION
,
parseWebviewStyle
}
from
'
./util
'
export
default
function
initNavigateTo
({
export
default
function
initNavigateTo
({
plus
,
__registerPage
__registerPage
})
{
})
{
return
function
navigateTo
(
path
,
{
return
function
navigateTo
(
path
,
{
animationType
,
animationType
,
animationDuration
animationDuration
})
{
})
{
const
webview
=
plus
.
webview
.
open
(
showWebview
(
''
,
__registerPage
({
String
(
getId
()),
path
parseWebviewStyle
(
path
),
}),
animationType
||
ANI_SHOW
,
animationType
,
animationDuration
||
ANI_DURATION
,
animationDuration
()
=>
{
)
console
.
log
(
'
show.callback
'
)
})
__registerPage
({
path
,
webview
})
}
}
}
}
src/platforms/app-plus-nvue/service/uni/router/util.js
已删除
100644 → 0
浏览文件 @
2d30a925
export
const
ANI_SHOW
=
'
pop-in
'
export
const
ANI_DURATION
=
300
let
id
=
0
export
function
getId
()
{
return
id
++
}
export
function
parseWebviewStyle
(
path
)
{
return
{
titleNView
:
{
autoBackButton
:
true
,
titleText
:
'
titleText
'
},
uniNView
:
{
path
}
}
}
src/platforms/app-plus-nvue/service/uni/router/webview.js
0 → 100644
浏览文件 @
33679d5d
export
const
ANI_DURATION
=
300
const
ANI_SHOW
=
'
pop-in
'
export
function
showWebview
(
webview
,
animationType
,
animationDuration
)
{
setTimeout
(()
=>
{
webview
.
show
(
animationType
||
ANI_SHOW
,
animationDuration
||
ANI_DURATION
,
()
=>
{
console
.
log
(
'
show.callback
'
)
}
)
},
50
)
}
src/platforms/app-plus/service/uni/bridge.js
0 → 100644
浏览文件 @
33679d5d
import
initOn
from
'
uni-core/service/bridge/on
'
export
function
initServiceJSBridge
(
Vue
)
{
const
Emitter
=
new
Vue
()
const
bridge
=
{
on
:
Emitter
.
$on
.
bind
(
Emitter
),
off
:
Emitter
.
$off
.
bind
(
Emitter
),
once
:
Emitter
.
$once
.
bind
(
Emitter
),
emit
:
Emitter
.
$emit
.
bind
(
Emitter
)
}
initOn
(
bridge
.
on
)
return
bridge
}
src/platforms/app-plus/service/uni/config.js
浏览文件 @
33679d5d
...
@@ -14,7 +14,8 @@ function parseRoutes (config) {
...
@@ -14,7 +14,8 @@ function parseRoutes (config) {
meta
:
{
meta
:
{
isQuit
,
isQuit
,
isTabBar
isTabBar
}
},
window
:
config
.
page
[
pagePath
]
||
{}
})
})
})
})
}
}
...
...
src/platforms/app-plus/service/uni/create-instance-context.js
浏览文件 @
33679d5d
...
@@ -16,25 +16,31 @@ import {
...
@@ -16,25 +16,31 @@ import {
import
{
import
{
createUniInstance
createUniInstance
}
from
'
./uni
'
}
from
'
./uni
'
import
{
initServiceJSBridge
}
from
'
./bridge
'
export
function
createInstanceContext
(
instanceContext
)
{
export
function
createInstanceContext
(
instanceContext
)
{
const
{
const
{
weex
,
weex
,
Vue
,
WeexPlus
WeexPlus
}
=
instanceContext
}
=
instanceContext
const
plus
=
new
WeexPlus
(
weex
)
const
plus
=
new
WeexPlus
(
weex
)
const
UniJSServiceBridge
=
initServiceJSBridge
(
Vue
)
return
{
return
{
__uniConfig
:
uniConfig
,
__uniConfig
:
uniConfig
,
__uniRoutes
:
uniRoutes
,
__uniRoutes
:
uniRoutes
,
__registerConfig
(
config
)
{
__registerConfig
(
config
)
{
registerConfig
(
config
,
instanceContext
)
re
turn
re
gisterConfig
(
config
,
instanceContext
)
},
},
__registerApp
(
appVm
)
{
__registerApp
(
appVm
)
{
registerApp
(
appVm
,
instanceContext
)
re
turn
re
gisterApp
(
appVm
,
instanceContext
)
},
},
__registerPage
(
page
)
{
__registerPage
(
page
)
{
registerPage
(
page
,
instanceContext
)
re
turn
re
gisterPage
(
page
,
instanceContext
)
},
},
plus
,
plus
,
uni
:
createUniInstance
(
uni
:
createUniInstance
(
...
@@ -46,6 +52,7 @@ export function createInstanceContext (instanceContext) {
...
@@ -46,6 +52,7 @@ export function createInstanceContext (instanceContext) {
getCurrentPages
getCurrentPages
),
),
getApp
,
getApp
,
getCurrentPages
getCurrentPages
,
UniJSServiceBridge
}
}
}
}
src/platforms/app-plus/service/uni/page.js
浏览文件 @
33679d5d
import
{
initWebview
,
createWebview
}
from
'
./webview
'
const
pages
=
[]
const
pages
=
[]
export
function
getCurrentPages
()
{
export
function
getCurrentPages
()
{
...
@@ -21,21 +26,32 @@ export function getCurrentPages () {
...
@@ -21,21 +26,32 @@ export function getCurrentPages () {
*
*
*
*
*/
*/
/**
* 首页需要主动registerPage,二级页面路由跳转时registerPage
*/
export
function
registerPage
({
export
function
registerPage
({
vm
,
path
,
path
,
webview
webview
},
instanceContext
)
{
},
instanceContext
)
{
const
routeOptions
=
instanceContext
.
__uniRoutes
.
find
(
route
=>
route
.
path
===
path
)
if
(
!
webview
)
{
webview
=
createWebview
(
path
,
instanceContext
,
routeOptions
.
window
)
}
if
(
process
.
env
.
NODE_ENV
!==
'
production
'
)
{
if
(
process
.
env
.
NODE_ENV
!==
'
production
'
)
{
console
.
log
(
`[uni-app] registerPage`
,
path
,
webview
.
id
)
console
.
log
(
`[uni-app] registerPage`
,
path
,
webview
.
id
)
}
}
initWebview
(
webview
,
instanceContext
,
webview
.
id
===
'
1
'
&&
routeOptions
.
window
)
pages
.
push
({
pages
.
push
({
route
:
path
.
slice
(
1
),
route
:
path
.
slice
(
1
),
$getAppWebview
()
{
$getAppWebview
()
{
return
webview
return
webview
},
},
$meta
:
instanceContext
.
__uniRoutes
.
find
(
route
=>
route
.
path
===
path
).
meta
,
$meta
:
routeOptions
.
meta
$vm
:
vm
})
})
return
webview
}
}
src/platforms/app-plus/service/uni/webview.js
0 → 100644
浏览文件 @
33679d5d
const
WEBVIEW_LISTENERS
=
[
'
close
'
,
'
resize
'
,
'
popGesture
'
,
'
pullToRefresh
'
,
'
titleNViewSearchInputChanged
'
,
'
titleNViewSearchInputConfirmed
'
,
'
titleNViewSearchInputClicked
'
]
let
id
=
1
function
parseWebviewStyle
(
path
,
windowOptions
=
{})
{
return
{
titleNView
:
{
autoBackButton
:
true
,
titleText
:
'
titleText
'
},
uniNView
:
{
path
}
}
}
function
parseWindowOptions
(
windowOptions
=
{},
globalWindowOptions
=
{})
{
// TODO
return
windowOptions
}
export
function
createWebview
(
path
,
{
plus
,
__uniConfig
},
windowOptions
)
{
return
plus
.
webview
.
create
(
''
,
String
(
id
++
),
parseWebviewStyle
(
path
,
parseWindowOptions
(
windowOptions
,
__uniConfig
.
window
)
))
}
export
function
initWebview
(
webview
,
{
UniJSServiceBridge
})
{
// TODO subNVues
WEBVIEW_LISTENERS
.
forEach
(
listener
=>
{
webview
.
addEventListener
(
listener
,
(
e
)
=>
{
UniJSServiceBridge
.
emit
(
listener
,
e
)
})
})
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录