Skip to content

Commit 5ef9c65

Browse files
committed
refactor: 更新逻辑
1 parent 4588bdc commit 5ef9c65

2 files changed

Lines changed: 16 additions & 6 deletions

File tree

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,22 @@ protected override void OnParametersSet()
148148
};
149149
}
150150

151+
/// <summary>
152+
/// <inheritdoc/>
153+
/// </summary>
154+
/// <returns></returns>
155+
protected override bool CheckCanUpload()
156+
{
157+
// 允许多上传
158+
if (IsMultiple)
159+
{
160+
return !MaxFileCount.HasValue || GetUploadFiles().Count < MaxFileCount;
161+
}
162+
163+
// 只允许单个上传
164+
return UploadFiles.Count == 0;
165+
}
166+
151167
/// <summary>
152168
/// 获得 数据验证客户端 ID
153169
/// </summary>

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

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -258,12 +258,6 @@ protected override void OnParametersSet()
258258
/// <returns></returns>
259259
protected override bool CheckCanUpload()
260260
{
261-
// 如果组件禁用了 IsDisabled 允许上传但是不出现 + 按钮
262-
if (IsDisabled)
263-
{
264-
return true;
265-
}
266-
267261
// 允许多上传
268262
if (IsMultiple)
269263
{

0 commit comments

Comments
 (0)