在我的MVC应用程序中,我想使用require.js。我正在尝试使用以下方式;
@Scripts.Render("~/bundles/require")
在要求.js文档中,它被记录为;
<!--This sets the baseUrl to the "scripts" directory, and
loads a script that will have a module ID of 'main'-->
<script data-main="scripts/main.js" src="scripts/require.js"></script>
所以我需要在MVC部分设置data-main="scripts/main.js"部分。
如何通过 Scripts.Render 函数添加额外的属性?
发现需要使用以下方式;
@Scripts.RenderFormat("<script type="text/javascript" data-main="/JavaScript/main.js" src="{0}"></script>", "~/bundles/require")