提交 60bec6d5 编写于 作者: Q qiang

Merge branch 'dev' into alpha

......@@ -19,4 +19,5 @@ export const VD_SYNC_CALLBACK = 'vdSyncCallback'
export const INVOKE_API = 'invokeApi'
export const WEB_INVOKE_APPSERVICE = 'WEB_INVOKE_APPSERVICE'
export const WEBVIEW_INSERTED = 'webviewInserted'
export const WEBVIEW_REMOVED = 'webviewRemoved'
export const WEBVIEW_REMOVED = 'webviewRemoved'
export const WEBVIEW_ID_PREFIX = 'webviewId'
......@@ -3,6 +3,10 @@ import {
ANI_DURATION
} from '../../constants'
import {
WEBVIEW_ID_PREFIX
} from '../../../constants'
import {
setStatusBarStyle
} from '../../bridge'
......@@ -30,7 +34,10 @@ function backWebview (webview, callback) {
if (!children || !children.length) { // 有子 webview
return callback()
}
const childWebview = children[0]
// 如果页面有subNvues,切使用了webview组件,则返回时子webview会取错,因此需要做id匹配
const childWebview = children.find(webview => webview.id.indexOf(WEBVIEW_ID_PREFIX) === 0) || children[0]
console.log('backWebview -> childWebview', childWebview)
childWebview.canBack(({
canBack
}) => {
......
......@@ -4,7 +4,8 @@
<script>
import {
WEBVIEW_INSERTED,
WEBVIEW_REMOVED
WEBVIEW_REMOVED,
WEBVIEW_ID_PREFIX
} from '../../../constants'
import { NAVBAR_HEIGHT } from 'uni-helpers/constants'
......@@ -92,7 +93,7 @@ export default {
}
},
mounted () {
this.htmlId = 'webviewId' + this.$page.id
this.htmlId = WEBVIEW_ID_PREFIX + this.$page.id
insertHTMLWebView({
htmlId: this.htmlId
})
......
......@@ -90,7 +90,7 @@ export default {
return !this.hideTabBar &&
(
this.$route.meta.isTabBar ||
(this.showLayout && this.tabBarMediaQuery) // 宽屏且符合tabBar的media
this.tabBarMediaQuery
)
}
},
......
......@@ -63,8 +63,8 @@ export default {
this.popupWidth = windowWidth
this.popupHeight = windowHeight + windowTop
}
this.$watch('visible', value => value && fixSize())
window.addEventListener('resize', fixSize)
fixSize()
this.$once('hook:beforeDestroy', () => {
window.removeEventListener('resize', fixSize)
})
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册