P粉1916105802023-08-17 00:28:09
To solve this problem, you can use the object-fit
CSS property. The object-fit attribute specifies how the image should be resized to fit its container. The cover value will resize the image to fill the entire container while maintaining its aspect ratio.
<span class="bg-dark d-flex justify-content-center align-items-center"> <img :src="slotProps.item.itemImageSrc" :alt="slotProps.item.alt" style="object-fit: cover; max-width: 100%; max-height: 100%" /> </span>