简体   繁体   English

类似于asp.net主页的客户端解决方案

[英]Client-side solution similar to asp.net master page

I recently started using WebStorm to implement web applications and find the experience much better than using Visual Studio. 我最近开始使用WebStorm来实现Web应用程序,并且发现体验比使用Visual Studio更好。

I am considering moving the "view" part in mvc to pure html as much as possible without relying on server template engine such as Razor. 我正在考虑将mvc中的“视图”部分尽可能移至纯html,而不依赖于Razor等服务器模板引擎。 So that I don't have to open visual studio until server side code is needed. 这样,在需要服务器端代码之前,我不必打开Visual Studio。

Google results showed that client side template engines such as Handlebars and Mustache will be able to help generate dynamic html pages. Google的结果表明,客户端模板引擎(如Handlebars和Mustache)将能够帮助生成动态html页面。 One thing I have not found is that ability to combine "parts" of pages together (like the master page in asp.net) so that we don't need to copy/paste header/footer everywhere. 我还没有发现的一件事就是能够将页面的“部分”组合在一起(例如asp.net中的母版页),这样我们就无需在各处复制/粘贴页眉/页脚。

How do I achieve "master page"-like functionality with client side (ie javascript) solutions? 如何通过客户端(即javascript)解决方案实现类似于“母版页”的功能?

Thanks for your help. 谢谢你的帮助。

You could try this: use 'shtml' file to struct your webpage,so that you can reference the include instruction: 您可以尝试以下方法:使用“ shtml”文件构建网页,以便您可以引用include指令:

<!--#include file="head.html"--><hr><b>Hello,this is body!</b><hr><!--#include file="foot.html"-->

As to 'head.html' and 'foot.html',well,you know what should include in them.Actually,they are 'div' segments~~~ 至于“ head.html”和“ foot.html”,您知道应该包括什么。实际上,它们是“ div”段~~~

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM