From 3d168a73f1af28f292d80ad71f04f6104b28fb77 Mon Sep 17 00:00:00 2001 From: fxy060608 Date: Fri, 30 Oct 2020 16:54:39 +0800 Subject: [PATCH] feat(h5): add --window-margin --- src/platforms/h5/components/app/layout.vue | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/platforms/h5/components/app/layout.vue b/src/platforms/h5/components/app/layout.vue index 56cb3f5895..a84fa75be7 100644 --- a/src/platforms/h5/components/app/layout.vue +++ b/src/platforms/h5/components/app/layout.vue @@ -200,12 +200,16 @@ export default { } else { updateCssVar('--window-right', '0px') } + }, + marginWidth (newVal) { + updateCssVar('--window-margin', newVal + 'px') } }, beforeCreate () { updateCssVar('--top-window-height', '0px') updateCssVar('--window-left', '0px') updateCssVar('--window-right', '0px') + updateCssVar('--window-margin', '0px') }, created () { this.topWindow = Vue.component('VUniTopWindow') @@ -281,7 +285,7 @@ export default { } this.$emit('maxWidth', showMaxWidth) if (!this.$containerElem) { - this.$containerElem = document.querySelector('uni-content,uni-app') + this.$containerElem = document.querySelector('uni-app') } if (!this.$containerElem) { return @@ -424,8 +428,8 @@ export default { .uni-top-window { position: fixed; - left: 0; - right: 0; + left: var(--window-margin); + right: var(--window-margin); top: 0; z-index: 998; overflow: hidden; -- GitLab