代码如下:
<div
class="menu-box"
v-if="showMenuBox"
>
<!-- 任意盒子,自定义内容 -->
</div>
<div
class="cover"
v-if="showMenuBox"
>
<!-- 遮罩蒙版-->
</div>
.menu-box {
position: relative;
text-align: center;
display: flex;
justify-content: center;
z-index: 1000;
}
.cover {
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
width: 100%;
height: 100%;
background-color: #000;
z-index: 999;
opacity: 0.5;
}