简体   繁体   English

在ASP.NET MVC 4中使用Scripts.Render时,在“script”标记中生成“type”属性

[英]Produce a “type” attribute in the “script” tag when using Scripts.Render in ASP.NET MVC 4

Is it possible to configure Scripts.Render in ASP.NET MVC 4 to produce a "type" attribute in the "script" tag? 是否可以在ASP.NET MVC 4中配置Scripts.Render以在“script”标记中生成“type”属性?

If so, how? 如果是这样,怎么样?

Thanks in advance, 提前致谢,

Ryan 瑞安

The 1.1-alpha1 update has support doing your own tag formatting with the Scripts/Styles helpers. 1.1-alpha1更新支持使用Scripts / Styles帮助程序进行自己的标记格式化。

There's a new DefaultTagFormat property which is by default set to: 有一个新的DefaultTagFormat属性,默认情况下设置为:

"<script src="{0}"></script>"

There's also a RenderFormat method which takes in the tag format as well. 还有一个RenderFormat方法,它也采用标记格式。 You should be able to add the type attribute via either of these two mechanicsms. 您应该能够通过这两种机制中的任何一种添加type属性。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 ASP.NET MVC Scripts.Render不合并文件..? - ASP.NET MVC Scripts.Render not merging files..? 在ASP.NET MVC4中对@query使用@ Scripts.Render导致js事件始终返回true - Using @Scripts.Render for jquery in ASP.NET MVC4 causes js events returning always true 我在ASP.NET MVC上使用Scripts.Render() - 在更新用户仍然获得旧(捆绑)脚本文件后6小时,原因是什么? - I am using Scripts.Render() on ASP.NET MVC - what can the reason be that 6 hours after the update users still get the old (bundled) script file? 如何将脚本延迟属性用于带有 Scripts.Render 的 ASP MVC 4 Bundles - How can I use the script defer attribute for ASP MVC 4 Bundles with Scripts.Render 为什么Asp.Net MVC 5将@ Scripts.Render(“〜/ bundles / jquery”)放在_Layout.cshtml的底部? - Why Asp.Net MVC 5 put @Scripts.Render(“~/bundles/jquery”) at the bottom in _Layout.cshtml? 使用 NWebSec 将 nonce 值添加到 @Scripts.Render ASP.Net MVC razor 页面 - Adding nonce value to @Scripts.Render ASP.Net MVC razor pages with NWebSec 使用 ASP.NET MVC 3 Helpers 渲染具有标题属性的 span 标记 - Render span tag with title attribute with ASP.NET MVC 3 Helpers ASP.NET MVC:使用TagBuilder渲染原始属性值 - ASP.NET MVC: Render raw attribute value using TagBuilder Scripts.Render()如果不存在 - Scripts.Render() if not exists 如何在.Net Core 2.0 MVC应用程序中使用@ Scripts.Render? - How can I use @Scripts.Render with .Net Core 2.0 MVC application?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM