<div class="bg-parent">
<img :src="employeeImg" class="bg-url" />
<div class="bg">
<el-icon class="plus-icon">
<Plus />
</el-icon>
</div>
</div>
.bg-parent{ //父级别
position: absolute;
}
.bg-url{ //子级别
width: 312px;
height: 152px;
border-radius: 8px;
position: absolute;
}
.bg{ 子级别
width: 312px;
height: 152px;
border-radius: 8px;
position: absolute;
z-index:1;
}
.plus-icon{
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
display: none; //背景图默认没有加号
}
.bg:hover { //鼠标移动上去添加背景加号
background-color: rgba(0, 0, 0, 0.4);
.plus-icon { //鼠标移动上去添加背景加号
display: block;
}
}