Skip to content

Commit c237053

Browse files
fix(Upload): IsDisabled not work (#7556)
* 修改上传组件IsDisabled为true时,还能选择文件的问题 修改上传组件IsDisabled为true时,还能选择文件的问题 * Update UploadBase.cs UploadBase基类两个已弃用的参数注释中加以说明,以备文档自动化能读取 * doc: 精简注释 * revert: 撤销更改 * fix(Upload): support IsDisabed parameter --------- Co-Authored-By: Tony-ST0754 <244411587+tony-st0754@users.noreply.github.com> Co-authored-by: Argo Zhang <argo@live.ca>
1 parent c14b931 commit c237053

2 files changed

Lines changed: 11 additions & 7 deletions

File tree

src/BootstrapBlazor/Components/Upload/UploadBase.cs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,20 @@ namespace BootstrapBlazor.Components;
1515
public abstract class UploadBase<TValue> : ValidateBase<TValue>, IUpload
1616
{
1717
/// <summary>
18-
/// <para lang="zh">获得/设置 是否仅上传一次,默认 false</para>
19-
/// <para lang="en">Gets or sets whether to upload only once. Default is false.</para>
18+
/// <para lang="zh">获得/设置 是否仅上传一次,默认 false(已弃用 请使用 IsMultiple 参数)</para>
19+
/// <para lang="en">Gets or sets whether to upload only once. Default is false. (Deprecated. Please use IsMultiple parameter)</para>
2020
/// </summary>
2121
[Parameter]
22-
[Obsolete("已弃用。请使用 IsMultiple 参数(Deprecated. Please use IsMultiple parameter.)")]
22+
[Obsolete("已弃用。请使用 IsMultiple 参数 (Deprecated. Please use IsMultiple parameter)")]
2323
[ExcludeFromCodeCoverage]
2424
public bool IsSingle { get; set; }
2525

2626
/// <summary>
27-
/// <para lang="zh">获得/设置 最大上传个数,默认为最大值 int.MaxValue</para>
28-
/// <para lang="en">Gets or sets the maximum number of files to upload. Default is int.MaxValue.</para>
27+
/// <para lang="zh">获得/设置 最大上传个数,默认为最大值 int.MaxValue(已弃用。请使用 MaxFileCount 参数。)</para>
28+
/// <para lang="en">Gets or sets the maximum number of files to upload. Default is int.MaxValue.(Deprecated. Please use MaxFileCount parameter.)</para>
2929
/// </summary>
3030
[Parameter]
31-
[Obsolete("已弃用。请使用 MaxFileCount 参数。(Deprecated. Please use MaxFileCount parameter.)")]
31+
[Obsolete("已弃用。请使用 MaxFileCount 参数。(Deprecated. Please use MaxFileCount parameter)")]
3232
[ExcludeFromCodeCoverage]
3333
public int Max { get; set; } = int.MaxValue;
3434

@@ -385,6 +385,10 @@ protected IDictionary<string, object> GetUploadAdditionalAttributes()
385385
{
386386
{ "hidden", "hidden" }
387387
};
388+
if (IsDisabled)
389+
{
390+
ret.Add("disabled", "disabled");
391+
}
388392
if (!string.IsNullOrEmpty(Accept))
389393
{
390394
ret.Add("accept", Accept);

src/BootstrapBlazor/wwwroot/modules/upload.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import Data from "./data.js"
1+
import Data from "./data.js"
22
import EventHandler from "./event-handler.js"
33

44
export function init(id) {

0 commit comments

Comments
 (0)