diff --git a/src/mixins/popup/index.js b/src/mixins/popup/index.js index 0b0c7a43d..e29527da5 100644 --- a/src/mixins/popup/index.js +++ b/src/mixins/popup/index.js @@ -46,6 +46,7 @@ export function PopupMixin(options = {}) { data() { return { inited: this.show, + currentZIndex: null, }; }, @@ -199,7 +200,7 @@ export function PopupMixin(options = {}) { }, updateZIndex(value = 0) { - this.$refs.root.style.zIndex = ++context.zIndex + value; + this.currentZIndex = ++context.zIndex + value; }, }, }; diff --git a/src/popup/index.js b/src/popup/index.js index c77cea282..99063760e 100644 --- a/src/popup/index.js +++ b/src/popup/index.js @@ -61,7 +61,13 @@ export default createComponent({ methods: { genOverlay() { if (this.overlay) { - return ; + return ( + + ); } }, @@ -73,7 +79,10 @@ export default createComponent({ this.transition || (isCenter ? 'van-fade' : `van-popup-slide-${position}`); - const style = {}; + const style = { + zIndex: this.currentZIndex, + }; + if (isDef(duration)) { const key = isCenter ? 'animationDuration' : 'transitionDuration'; style[key] = `${duration}s`; @@ -88,7 +97,6 @@ export default createComponent({ {this.shouldRender ? (