diff --git a/uview-ui/components/u-mask/u-mask.vue b/uview-ui/components/u-mask/u-mask.vue index 0b55d9d8..1eb15152 100644 --- a/uview-ui/components/u-mask/u-mask.vue +++ b/uview-ui/components/u-mask/u-mask.vue @@ -80,8 +80,15 @@ maskStyle() { let style = {}; style.backgroundColor = "rgba(0, 0, 0, 0.6)"; - if(this.show) style.zIndex = this.zIndex ? this.zIndex : this.$u.zIndex.mask; - else style.zIndex = -1; + if(this.show) { + // 如果传入了zIndex(包括0),使用传入的值;否则使用默认值 + // 使用 !== '' 和 !== null 和 !== undefined 来判断是否传入了值 + style.zIndex = (this.zIndex !== '' && this.zIndex !== null && this.zIndex !== undefined) + ? Number(this.zIndex) + : this.$u.zIndex.mask; + } else { + style.zIndex = -1; + } style.transition = `all ${this.duration / 1000}s ease-in-out`; // 判断用户传递的对象是否为空,不为空就进行合并 if (Object.keys(this.customStyle).length) style = { diff --git a/uview-ui/components/u-popup/u-popup.vue b/uview-ui/components/u-popup/u-popup.vue index 69c0ec8d..357979ab 100644 --- a/uview-ui/components/u-popup/u-popup.vue +++ b/uview-ui/components/u-popup/u-popup.vue @@ -2,7 +2,7 @@ - +