提交 9a97f289 编写于 作者: DCloud-WZF's avatar DCloud-WZF 💬

feat(web-view): 支持通过 webviewStyles 设置样式

上级 6535437a
...@@ -12,17 +12,21 @@ import { NAVBAR_HEIGHT } from 'uni-helpers/constants' ...@@ -12,17 +12,21 @@ import { NAVBAR_HEIGHT } from 'uni-helpers/constants'
let webview = false let webview = false
const insertHTMLWebView = ({ const insertHTMLWebView = ({
webviewStyles,
htmlId, htmlId,
updateTitle updateTitle
}) => { }) => {
const parentWebview = plus.webview.currentWebview() const parentWebview = plus.webview.currentWebview()
// fixed by hxy web-view 组件所在的 webview 不注入 uni-app 框架 // fixed by hxy web-view 组件所在的 webview 不注入 uni-app 框架
const styles = { const styles = Object.assign(
{
'uni-app': 'none', 'uni-app': 'none',
isUniH5: true, isUniH5: true,
// ios 默认绘制到安全区外 // ios 默认绘制到安全区外
contentAdjust: false contentAdjust: false
} },
webviewStyles
)
const parentTitleNView = parentWebview.getTitleNView() const parentTitleNView = parentWebview.getTitleNView()
if (parentTitleNView) { if (parentTitleNView) {
if (plus.navigator.isImmersedStatusbar()) { if (plus.navigator.isImmersedStatusbar()) {
...@@ -102,6 +106,7 @@ export default { ...@@ -102,6 +106,7 @@ export default {
mounted () { mounted () {
this.htmlId = WEBVIEW_ID_PREFIX + this.$page.id this.htmlId = WEBVIEW_ID_PREFIX + this.$page.id
insertHTMLWebView({ insertHTMLWebView({
webviewStyles: this.webviewStyles,
htmlId: this.htmlId, htmlId: this.htmlId,
updateTitle: this.updateTitle updateTitle: this.updateTitle
}) })
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册