[fix] Upload area overflows the container range

This commit is contained in:
root 2025-12-09 10:04:57 +08:00
parent 678317ae04
commit 904876bd89

View file

@ -57,23 +57,25 @@
</div> </div>
</div> </div>
<div v-if="modelValue.light.backgroundType === 'image'" class="upload-side"> <div v-if="modelValue.light.backgroundType === 'image'" class="upload-center">
<el-upload <div class="upload-side">
class="dashed-upload" <el-upload
action="" class="dashed-upload"
:auto-upload="false" action=""
:on-change="(f)=>handleBgUpload(f, 'light')" :auto-upload="false"
accept=".png,.jpg,.jpeg" :on-change="(f)=>handleBgUpload(f, 'light')"
:show-file-list="false" accept=".png,.jpg,.jpeg"
drag :show-file-list="false"
> drag
<i class="el-icon-upload"></i> >
<div class="el-upload__text">{{ $t('device.customThemeBackgroundImageUpload') }}</div> <i class="el-icon-upload"></i>
</el-upload> <div class="el-upload__text">{{ $t('device.customThemeBackgroundImageUpload') }}</div>
<span class="file-name" v-if="modelValue.light.backgroundImage">{{ fileName(modelValue.light.backgroundImage) }}</span> </el-upload>
<el-button v-if="modelValue.light.backgroundImage" size="mini" type="text" @click="clearBg('light')"> <span class="file-name" v-if="modelValue.light.backgroundImage">{{ fileName(modelValue.light.backgroundImage) }}</span>
{{ $t('device.customThemeRemoveImage') }} <el-button v-if="modelValue.light.backgroundImage" size="mini" type="text" @click="clearBg('light')">
</el-button> {{ $t('device.customThemeRemoveImage') }}
</el-button>
</div>
</div> </div>
</div> </div>
</div> </div>
@ -130,23 +132,25 @@
</div> </div>
</div> </div>
<div v-if="modelValue.dark.backgroundType === 'image'" class="upload-side"> <div v-if="modelValue.dark.backgroundType === 'image'" class="upload-center">
<el-upload <div class="upload-side">
class="dashed-upload" <el-upload
action="" class="dashed-upload"
:auto-upload="false" action=""
:on-change="(f)=>handleBgUpload(f, 'dark')" :auto-upload="false"
accept=".png,.jpg,.jpeg" :on-change="(f)=>handleBgUpload(f, 'dark')"
:show-file-list="false" accept=".png,.jpg,.jpeg"
drag :show-file-list="false"
> drag
<i class="el-icon-upload"></i> >
<div class="el-upload__text">{{ $t('device.customThemeBackgroundImageUpload') }}</div> <i class="el-icon-upload"></i>
</el-upload> <div class="el-upload__text">{{ $t('device.customThemeBackgroundImageUpload') }}</div>
<span class="file-name" v-if="modelValue.dark.backgroundImage">{{ fileName(modelValue.dark.backgroundImage) }}</span> </el-upload>
<el-button v-if="modelValue.dark.backgroundImage" size="mini" type="text" @click="clearBg('dark')"> <span class="file-name" v-if="modelValue.dark.backgroundImage">{{ fileName(modelValue.dark.backgroundImage) }}</span>
{{ $t('device.customThemeRemoveImage') }} <el-button v-if="modelValue.dark.backgroundImage" size="mini" type="text" @click="clearBg('dark')">
</el-button> {{ $t('device.customThemeRemoveImage') }}
</el-button>
</div>
</div> </div>
</div> </div>
</div> </div>
@ -408,6 +412,8 @@ export default {
border-radius: 8px; border-radius: 8px;
padding: 8px; padding: 8px;
height: 100%; height: 100%;
box-sizing: border-box;
overflow: hidden;
} }
.mode-buttons { .mode-buttons {
margin-bottom: 10px; margin-bottom: 10px;
@ -418,12 +424,29 @@ export default {
align-items: stretch; align-items: stretch;
gap: 12px; gap: 12px;
flex-wrap: nowrap; flex-wrap: nowrap;
width: 100%;
max-width: 100%;
box-sizing: border-box;
overflow: hidden;
} }
.color-stack { .color-stack {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 10px; gap: 10px;
min-width: 0; min-width: 0;
flex: 0 0 auto;
max-width: 100%;
}
.upload-center {
display: flex;
flex: 1;
justify-content: center;
align-items: center;
min-width: 120px;
max-width: 100%;
overflow: visible;
box-sizing: border-box;
padding: 0 10px;
} }
.color-item { .color-item {
display: flex; display: flex;
@ -453,24 +476,27 @@ export default {
border-radius: 4px; border-radius: 4px;
} }
.dashed-upload { .dashed-upload {
display: flex;
width: 100%;
box-sizing: border-box;
border: none; border: none;
padding: 0; padding: 0;
} justify-content: center;
.dashed-upload {
display: flex;
flex: 1;
} }
.dashed-upload .el-upload-dragger { .dashed-upload .el-upload-dragger {
border: 2px dashed #909399; border: 2px dashed #909399;
border-radius: 4px; border-radius: 4px;
padding: 2px 0; padding: 2px 0;
width: 100px; width: 100px;
min-width: 100px;
max-width: 100px;
display: inline-flex; display: inline-flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
height: 100%; height: 100%;
box-sizing: border-box; box-sizing: border-box;
flex-shrink: 0;
} }
.upload-row .file-name, .upload-row .file-name,
.inline-upload .file-name, .inline-upload .file-name,
@ -483,9 +509,14 @@ export default {
flex-direction: column; flex-direction: column;
justify-content: center; justify-content: center;
gap: 4px; gap: 4px;
width: 120px;
min-width: 120px; min-width: 120px;
max-width: 120px;
flex-shrink: 0;
flex-grow: 0;
align-items: flex-start; align-items: flex-start;
align-self: stretch; box-sizing: border-box;
overflow: visible;
} }
.dashed-upload .el-upload__text { .dashed-upload .el-upload__text {
font-size: 12px; font-size: 12px;