fix: 修复商品图片超出容器问题,约束el-image组件尺寸
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -143,19 +143,28 @@ function buyNow() {
|
|||||||
background: rgba(255, 255, 255, 0.04);
|
background: rgba(255, 255, 255, 0.04);
|
||||||
border-radius: 12px;
|
border-radius: 12px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
position: relative;
|
||||||
|
|
||||||
.carousel-image, .single-image {
|
.carousel-image, .single-image {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 400px;
|
height: 100%;
|
||||||
display: flex;
|
display: block;
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
// 约束 el-image 组件
|
||||||
cursor: pointer;
|
:deep(.el-image) {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
// 确保图片按比例缩放显示
|
// 确保图片按比例缩放显示
|
||||||
:deep(.el-image__inner) {
|
:deep(.el-image__inner) {
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
max-height: 100%;
|
max-height: 100%;
|
||||||
|
width: auto;
|
||||||
|
height: auto;
|
||||||
object-fit: contain;
|
object-fit: contain;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -221,14 +230,10 @@ h1 { font-size: 28px; color: #fff; margin-bottom: 16px; }
|
|||||||
|
|
||||||
.product-images {
|
.product-images {
|
||||||
height: 300px;
|
height: 300px;
|
||||||
}
|
|
||||||
|
|
||||||
.carousel-image, .single-image {
|
.image-placeholder {
|
||||||
height: 300px;
|
height: 300px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.image-placeholder {
|
|
||||||
height: 300px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
h1 {
|
h1 {
|
||||||
|
|||||||
Reference in New Issue
Block a user