Files
mini-programs/src/components/ImageUpload/ImageUpload.scss
2025-08-23 15:14:37 +08:00

110 lines
2.0 KiB
SCSS

// 在组件SCSS文件中
@use '~@/scss/images.scss' as img;
.cover-image-upload {
margin-bottom: 8px;
.cover-scroll {
white-space: nowrap;
overflow-x: auto;
-webkit-overflow-scrolling: touch;
}
.cover-list {
display: inline-flex;
padding: 0 4px;
min-width: 100%;
transition: justify-content 0.3s ease;
&.center {
justify-content: center;
}
}
.cover-item {
flex-shrink: 0;
width: 108px;
height: 108px;
border-radius: 12px;
margin-right: 6px;
position: relative;
overflow: hidden;
transition: all 0.3s ease;
animation: slideIn 0.3s ease-out;
@keyframes slideIn {
from {
opacity: 0;
transform: scale(0.8);
}
to {
opacity: 1;
transform: scale(1);
}
}
&.add-btn {
border: 2px dashed #d9d9d9;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
.add-icon {
font-size: 32px;
color: #999;
margin-bottom: 8px;
}
.add-text {
font-size: 12px;
color: #999;
text-align: center;
line-height: 1.2;
}
}
&.image-item {
.cover-image {
width: 100%;
height: 100%;
border-radius: 12px;
transition: opacity 0.3s ease;
&:not([src]) {
opacity: 0;
}
}
.delete-btn {
position: absolute;
top: 8px;
right: 8px;
width: 20px;
height: 20px;
background: rgba(0, 0, 0, 0.6);
color: white;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
font-size: 14px;
font-weight: bold;
}
}
}
}
// 暗色模式适配
@media (prefers-color-scheme: dark) {
.cover-image-upload {
.cover-item.add-btn {
background: #2d2d2d;
border-color: #555;
.add-icon,
.add-text {
color: #999;
}
}
}
}