ASP.NET MVC - RequireJS最佳的多页面应用程序解决方案

时间:2022-10-11 20:08:33

I'm trying to convert one of my current MVC sites to using requirejs.....I was able to get things to "work"....but, what I have done looks messy.

我正在尝试将我当前的一个MVC网站转换为使用requirejs .....我能够让事情“工作”......但是,我所做的看起来很混乱。

Everything I have found on the internet in relation to requirejs really concentrates on single page apps [e.g., John Papa's Code Camper]...HOWEVER, in my case, this is a multi-page app.....and from what I can see, the "main.js" methodology really is only useful for SPA.

我在互联网上发现的与requirejs相关的一切都集中在单页应用程序[例如,John Papa的Code Camper] ......但是,在我的情况下,这是一个多页应用程序......而且我从可以看出,“main.js”方法确实只对SPA有用。

I have read over and downloaded Stephan Prodan's implementation of RequireJS server side: http://www.stefanprodan.eu/2012/09/intro-requirejs-for-asp-net-mvc/

我已阅读并下载了Stephan Prodan对RequireJS服务器端的实现:http://www.stefanprodan.eu/2012/09/intro-requirejs-for-asp-net-mvc/

I'm not sure if this is the model that will fit best....Does ANYONE have some good models (examples) of what they have used for using requirejs in a multi-page scenario for ASP.NET MVC?

我不确定这是否是最适合的模型....在ASP.NET MVC的多页面场景中,任何人都有一些好的模型(例子)用于使用requirejs吗?

Or....do you think Stephan's approach is sufficient?

或者......你认为斯蒂芬的方法是否足够?

I'm stuck and can't seem to actually make a decision and pull the trigger either way.

我卡住了,似乎无法做出决定并以任何方式拉动扳机。

1 个解决方案

#1


3  

Try following the guidance for a generic multi-page application here: https://*.com/a/10816983/1225352.

请尝试遵循通用多页面应用程序的指南:https://*.com/a/10816983/1225352。

That answer references an example multi-page application from the author of requirejs here: https://github.com/requirejs/example-multipage

该答案引用了requirejs作者的示例多页面应用程序:https://github.com/requirejs/example-multipage

#1


3  

Try following the guidance for a generic multi-page application here: https://*.com/a/10816983/1225352.

请尝试遵循通用多页面应用程序的指南:https://*.com/a/10816983/1225352。

That answer references an example multi-page application from the author of requirejs here: https://github.com/requirejs/example-multipage

该答案引用了requirejs作者的示例多页面应用程序:https://github.com/requirejs/example-multipage