提交 ac10a50a 编写于 作者: fxy060608's avatar fxy060608

fix(h5): layout.vue

上级 3d168a73
......@@ -275,10 +275,11 @@ export default {
this.checkMaxWidth()
})
},
checkMaxWidth () {
checkMaxWidth () {
const windowWidth = document.body.clientWidth
const maxWidth = parseInt(this.$route.meta.maxWidth)
let showMaxWidth = false
if (window.innerWidth > maxWidth) {
if (windowWidth > maxWidth) {
showMaxWidth = true
} else {
showMaxWidth = false
......@@ -291,11 +292,11 @@ export default {
return
}
if (showMaxWidth && maxWidth) {
this.marginWidth = (window.innerWidth - maxWidth) / 2
this.marginWidth = (windowWidth - maxWidth) / 2
this.$nextTick(() => {
this.onLeftWindowInit()
this.onRightWindowInit()
this.$containerElem.setAttribute('style', 'max-width:' + maxWidth + 'px;margin:0 auto')
this.$containerElem.setAttribute('style', 'max-width:' + maxWidth + 'px;margin:0 auto;')
})
} else {
this.marginWidth = 0
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册