Skip to content

Commit e6bd49b

Browse files
author
马云海 mayunhai ()
committed
用background替代img,防止图片变形
1 parent 08e6456 commit e6bd49b

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/components/PanThumb/index.vue

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
<slot />
66
</div>
77
</div>
8-
<img :src="image" class="pan-thumb">
8+
<!-- eslint-disable-next-line -->
9+
<div :style="{backgroundImage: `url(${image})`}" class="pan-thumb"></div>
910
</div>
1011
</template>
1112

@@ -52,7 +53,8 @@ export default {
5253
.pan-thumb {
5354
width: 100%;
5455
height: 100%;
55-
background-size: 100%;
56+
background-position: center center;
57+
background-size: cover;
5658
border-radius: 50%;
5759
overflow: hidden;
5860
position: absolute;

0 commit comments

Comments
 (0)