直接上正确代码,至于别人说的@οnerrοr=“url”,这种方法,亲测~~不可用
<img class="avatar" :src="docAvatar">
.avatar {
width: 40px;
height: 40px;
position: relative;
}
.avatar:after {
content: "";
display: inline-block;
position: absolute;
z-index: 2;
top: 0;
left: 0;
width: 40px;
height: 40px;
background-image: url("./../assets/img/doctor.jpg");
background-size: cover;
background-color: #fff;
}