Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
genary
uni-app
提交
86e1d0a3
U
uni-app
项目概览
genary
/
uni-app
与 Fork 源项目一致
Fork自
DCloud / uni-app
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-app
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
86e1d0a3
编写于
5月 26, 2021
作者:
D
DCloud_LXH
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
chore: web-view brige
上级
8a90c54c
变更
6
展开全部
隐藏空白更改
内联
并排
Showing
6 changed file
with
16377 addition
and
16356 deletion
+16377
-16356
packages/uni-core/src/service/plugin/on.ts
packages/uni-core/src/service/plugin/on.ts
+0
-2
packages/uni-h5/dist/uni-h5.cjs.js
packages/uni-h5/dist/uni-h5.cjs.js
+5476
-5467
packages/uni-h5/dist/uni-h5.es.js
packages/uni-h5/dist/uni-h5.es.js
+10882
-10881
packages/uni-h5/src/platform/index.ts
packages/uni-h5/src/platform/index.ts
+0
-1
packages/uni-h5/src/service/onWebInvokeAppService.ts
packages/uni-h5/src/service/onWebInvokeAppService.ts
+12
-4
packages/uni-h5/src/view/components/web-view/index.tsx
packages/uni-h5/src/view/components/web-view/index.tsx
+7
-1
未找到文件。
packages/uni-core/src/service/plugin/on.ts
浏览文件 @
86e1d0a3
import
{
ComponentPublicInstance
}
from
'
@vue/runtime-core
'
import
{
getCurrentPage
,
invokeHook
}
from
'
./page
'
import
{
onWebInvokeAppService
}
from
'
@dcloudio/uni-platform
'
export
function
initOn
()
{
UniServiceJSBridge
.
on
(
'
onAppEnterForeground
'
,
onAppEnterForeground
)
UniServiceJSBridge
.
on
(
'
onAppEnterBackground
'
,
onAppEnterBackground
)
UniServiceJSBridge
.
on
(
'
onWebInvokeAppService
'
,
onWebInvokeAppService
)
}
function
onAppEnterForeground
()
{
...
...
packages/uni-h5/dist/uni-h5.cjs.js
浏览文件 @
86e1d0a3
此差异已折叠。
点击以展开。
packages/uni-h5/dist/uni-h5.es.js
浏览文件 @
86e1d0a3
此差异已折叠。
点击以展开。
packages/uni-h5/src/platform/index.ts
浏览文件 @
86e1d0a3
...
...
@@ -14,4 +14,3 @@ export {
export
*
from
'
./saveImage
'
export
*
from
'
./constants
'
export
{
getSameOriginUrl
}
from
'
../helpers/file
'
export
{
onWebInvokeAppService
}
from
'
../service/onWebInvokeAppService
'
packages/uni-h5/src/service/onWebInvokeAppService.ts
浏览文件 @
86e1d0a3
...
...
@@ -5,11 +5,19 @@ type Name =
|
'
reLaunch
'
|
'
redirectTo
'
|
'
postMessage
'
type
WebInvokeData
=
{
name
:
Name
arg
:
any
}
export
type
WebInvokeAppService
=
(
webInvokeData
:
WebInvokeData
,
pageId
:
number
|
number
[]
)
=>
void
export
function
onWebInvokeAppService
(
{
name
,
arg
}
:
{
name
:
Name
;
arg
:
any
}
,
pageId
:
number
)
{
export
const
onWebInvokeAppService
:
WebInvokeAppService
=
(
{
name
,
arg
},
pageId
)
=>
{
if
(
name
===
'
postMessage
'
)
{
// TODO 小程序后退、组件销毁、分享时通知
}
else
{
...
...
packages/uni-h5/src/view/components/web-view/index.tsx
浏览文件 @
86e1d0a3
...
...
@@ -5,7 +5,12 @@ import {
useAttrs
,
}
from
'
@dcloudio/uni-components
'
import
{
getRealPath
}
from
'
@dcloudio/uni-platform
'
import
{
updateElementStyle
}
from
'
@dcloudio/uni-shared
'
import
{
updateElementStyle
,
once
}
from
'
@dcloudio/uni-shared
'
import
{
onWebInvokeAppService
}
from
'
../../../service/onWebInvokeAppService
'
const
Invoke
=
/*#__PURE__*/
once
(()
=>
UniServiceJSBridge
.
on
(
'
onWebInvokeAppService
'
,
onWebInvokeAppService
)
)
const
props
=
{
src
:
{
...
...
@@ -21,6 +26,7 @@ export default /*#__PURE__*/ defineBuiltInComponent({
name
:
'
WebView
'
,
props
,
setup
(
props
,
{
attrs
})
{
Invoke
()
const
rootRef
:
RootRef
=
ref
(
null
)
const
iframeRef
:
RootRef
=
ref
(
null
)
const
_resize
=
useWebViewSize
(
rootRef
,
iframeRef
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录