自定义组件使用cover-view,设置z-index不能准确控制层级

发布于 8 年前作者 qiangtan12892 次浏览最后编辑 8 年前来自 ask

组件一弹层样式

.mask-box-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 999999999999999999999999999999;
  background: rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.picker-box {
  position: relative;
  z-index: 9999999;
  width: 100vw;
  box-sizing: border-box;
  background: rgba(255, 255, 255, 1);
  border-radius: 24rpx 24rpx 0 0;
  display: flex;
  flex-direction: column;
}

组件二按钮样式

.show-map {
  box-sizing: border-box;
  display: flex;
  justify-content: center;
  position: relative;
}

.show-map .location {
  position: absolute;
  width: 60rpx;
  height: 60rpx;
  border-radius: 50%;
  z-index: 9;
  bottom: 20rpx;
  right: 20rpx;
}
1 回复
donglei
donglei1 楼5 年前

cover-view的层级是会比其他view高,小程序现在也支持同层渲染了,你可以用view替代cover-view看看