Skip to content

Commit 921b06c

Browse files
committed
refactor: 统一使用 btn-browser 作为上传按钮
1 parent d73751e commit 921b06c

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

src/BootstrapBlazor/Components/Upload/DropUpload.razor

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<BootstrapLabel required="@Required" ShowLabelTooltip="ShowLabelTooltip" Value="@DisplayText"/>
77
}
88
<div @attributes="@AdditionalAttributes" class="@ClassString" id="@Id">
9-
<div class="upload-drop-body">
9+
<div class="@BodyClassString">
1010
@if (BodyTemplate != null)
1111
{
1212
@BodyTemplate

src/BootstrapBlazor/Components/Upload/DropUpload.razor.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,10 @@ public partial class DropUpload
7575
.AddClassFromAttributes(AdditionalAttributes)
7676
.Build();
7777

78+
private string? BodyClassString => CssBuilder.Default("upload-drop-body")
79+
.AddClass("btn-browser", !IsDisabled)
80+
.Build();
81+
7882
/// <summary>
7983
/// <inheritdoc/>
8084
/// </summary>

src/BootstrapBlazor/wwwroot/modules/upload.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,6 @@ export function init(id) {
1515
inputFile.click()
1616
})
1717

18-
EventHandler.on(el, 'click', '.upload-drop-body', () => {
19-
inputFile.click()
20-
})
21-
2218
EventHandler.on(document, "dragleave", preventHandler)
2319
EventHandler.on(document, 'drop', preventHandler)
2420
EventHandler.on(document, 'dragenter', preventHandler)

0 commit comments

Comments
 (0)