【发布时间】:2021-09-05 18:31:40
【问题描述】:
我在 Angular 7 应用程序中实现了ngx-file-drop 组件,它允许拖放文件上传。我需要更改内容区域的背景,其中 while 与图像一起放置。我尝试css 并分配contentClassName 属性,如
contentClassName = "upload-background-image"
.upload-background-image {
background-image: "./images/spritemap.png"
它没有应用背景图片。我该怎么办。这是stackblitx
html
<div class="center" class="file-upload-wrapper">
<ngx-file-drop
dropZoneLabel="Drop files here"
multiple="true"
(onFileDrop)="dropped($event)"
(onFileOver)="fileOver($event)"
(onFileLeave)="fileLeave($event)">
<ng-template ngx-file-drop-content-tmp let-openFileSelector="openFileSelector">
Optional custom content that replaces the the entire default content.
<button type="button" (click)="openFileSelector()">Browse Files</button>
</ng-template>
</ngx-file-drop>
<div class="upload-table">
<table class="table">
<thead>
<tr>
<th>Name</th>
</tr>
</thead>
<tbody class="upload-name-style">
<tr *ngFor="let item of files; let i=index">
<td><strong>{{ item.relativePath }}</strong></td>
</tr>
</tbody>
</table>
</div>
</div>
当我尝试应用以下 css 时,它仍然不适用
.ngx-file-drop__drop-zone {
margin: 20px;
height: 250px;
background: #333;
color: #fff;
border: 5px dashed rgb(235, 79, 79);
border-radius: 5px;
font-size: 20px;
}
html 元素外观的屏幕截图
【问题讨论】: