diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/ScriptTagHelper.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/ScriptTagHelper.cs index 2328b73baf8..452b726c966 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/ScriptTagHelper.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/ScriptTagHelper.cs @@ -11,9 +11,6 @@ public class ScriptTagHelper : AbpTagHelper { protected AbpBundlingOptions Options { get; } - [HtmlAttributeName("src")] - public string Src { get; set; } = default!; - public ScriptTagHelper(IOptions options) { Options = options.Value; @@ -25,7 +22,9 @@ public override void Process(TagHelperContext context, TagHelperOutput output) output.Attributes.Add("defer", ""); } - if (!Src.IsNullOrWhiteSpace() && Options.DeferScripts.Any(x => Src.Equals(x, StringComparison.OrdinalIgnoreCase))) + var src = output.Attributes["src"]?.Value?.ToString(); + + if (!src.IsNullOrWhiteSpace() && Options.DeferScripts.Any(x => src.Equals(x, StringComparison.OrdinalIgnoreCase))) { output.Attributes.Add("defer", ""); }