mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-08-20 10:59:46 +08:00
fix(Popup): overlay z-index
This commit is contained in:
parent
9fa7a258d7
commit
5db6e380fe
@ -46,6 +46,7 @@ export function PopupMixin(options = {}) {
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
inited: this.show,
|
inited: this.show,
|
||||||
|
currentZIndex: null,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -199,7 +200,7 @@ export function PopupMixin(options = {}) {
|
|||||||
},
|
},
|
||||||
|
|
||||||
updateZIndex(value = 0) {
|
updateZIndex(value = 0) {
|
||||||
this.$refs.root.style.zIndex = ++context.zIndex + value;
|
this.currentZIndex = ++context.zIndex + value;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -61,7 +61,13 @@ export default createComponent({
|
|||||||
methods: {
|
methods: {
|
||||||
genOverlay() {
|
genOverlay() {
|
||||||
if (this.overlay) {
|
if (this.overlay) {
|
||||||
return <Overlay show={this.show} onClick={this.onClickOverlay} />;
|
return (
|
||||||
|
<Overlay
|
||||||
|
show={this.show}
|
||||||
|
zIndex={this.currentZIndex}
|
||||||
|
onClick={this.onClickOverlay}
|
||||||
|
/>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -73,7 +79,10 @@ export default createComponent({
|
|||||||
this.transition ||
|
this.transition ||
|
||||||
(isCenter ? 'van-fade' : `van-popup-slide-${position}`);
|
(isCenter ? 'van-fade' : `van-popup-slide-${position}`);
|
||||||
|
|
||||||
const style = {};
|
const style = {
|
||||||
|
zIndex: this.currentZIndex,
|
||||||
|
};
|
||||||
|
|
||||||
if (isDef(duration)) {
|
if (isDef(duration)) {
|
||||||
const key = isCenter ? 'animationDuration' : 'transitionDuration';
|
const key = isCenter ? 'animationDuration' : 'transitionDuration';
|
||||||
style[key] = `${duration}s`;
|
style[key] = `${duration}s`;
|
||||||
@ -88,7 +97,6 @@ export default createComponent({
|
|||||||
{this.shouldRender ? (
|
{this.shouldRender ? (
|
||||||
<div
|
<div
|
||||||
vShow={this.show}
|
vShow={this.show}
|
||||||
ref="root"
|
|
||||||
style={style}
|
style={style}
|
||||||
class={bem({
|
class={bem({
|
||||||
round,
|
round,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user