JsRender/JsViews与其他基于模板的框架 [英] JsRender/JsViews vs other template based frameworks

查看:89
本文介绍了JsRender/JsViews与其他基于模板的框架的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

多年来,一直使用Microsoft的Ajax框架来制作具有UI渲染功能的单页应用程序,其中50%的客户端和50%的服务器在工作.想要移至100%UI客户端渲染,并正在寻找模板引擎.我最近发现 JsRender/JsViews ,我已经在其中做了几页,到目前为止,我非常喜欢但是后来我开始研究其他人在做什么以及最流行的框架在做这类事情,而以前从未使用过这种东西.

顶级框架(在2019年)似乎是React,Vue和Angular.我广泛阅读了每种语言,并决定在这三种语言中Vue最适合我,但是现在我想知道使用不太受欢迎的库(如JsRender)有什么好处.对于那些选择使用JsRender而不是其他使用JsRender的人来说,是什么让您选择它,并且与上面提到的三个相比,它有什么优势?

解决方案

我们将JsViews用于我们的项目.我们拒绝棱角分明并做出反应,因为我们需要一些苗条的东西,这些东西不会干扰我们现有的asp.net Webforms应用程序.也许您听说过这是Angular方式或高速公路". JsViews可以很好地做到这一点. Vue可能也适用于此应用程序.

您可能可以使用任何框架来完成您想做的所有事情,所以这可能很重要.

关于支持和错误修正:JsViews是首屈一指的.我们遇到了两个问题.所有这些都已在一天左右的时间内解决了.创建者对这个框架非常热衷.老实说,我认为从较小的框架中进行修复比较容易.

对于大型框架的预测,将会有更多的代码出现,但是我个人认为这不是一个大问题.我们在项目中使用引导程序,因此大多数内容只是编写正确的标记.在我们需要动态生成所述标记和/或需要脚本的地方,我们将这些内容封装在可重用标签(认为组件)中.这意味着您自己可以编写一些代码,但是根据我的经验,重复使用其他组件通常会使我缺乏功能或外​​观,并且与配置自己编写自定义组件所花费的时间相比,我通常会花费更多的时间来尝试配置该组件./p>

JsViews的文档非常完整.也有很多例子. Vue还具有相当完整的文档和良好的社区支持.

我也将Vue用于其他项目,就功能而言,它与JsViews十分相似,但我仍然认为,一旦了解它,JsViews的功能会更强大,而且我更喜欢JsViews模板而不是Vue模板.同样在Vue中,我觉得我必须配置"我的视图模型,使其更适合JsViews中的Vue wheras.我只是将其交给我的视图模型.特别是,我真的很喜欢辅助方法和转换器的概念,以将视图与模型分开.基本上,JsViews感觉就像是我个人喜欢的WPF的子集.

我认为JsViews的基本概念非常容易学习:数据绑定,转换器,帮助器等.自定义标签稍微复杂一些,但并不过分.

如果我必须选择一个流行的框架,我会选择Vue,但就我个人而言,我认为JsViews更加强大. 万一让您感觉更好,我敢打赌,所有这些框架都将被其他东西取代,因此您可能不想盲目地关注流行度:)

Have been using Microsoft's Ajax framework for years to make single page applications with the division of UI render work around 50% client, 50% server. Want to move to 100% UI client side rendering and was looking for a templating engine. I recently found JsRender/JsViews which I have already made a few pages with and so far I like it very much but then I started looking at what others are doing and what the most popular frameworks are for doing these type of things not having used anything like this before.

The top frameworks (in 2019) seem to be React, Vue, and Angular. I read extensively about each and have decided that Vue is the best for me out of these three but now I wonder what is the advantage of using a less popular library like JsRender. For those of you who have chosen to use JsRender over the others, what made you choose it and what advantages might it have over the three mentioned above?

解决方案

We use JsViews for our project. We rejected angular and react because we required something slim that would not intervene with our existing asp.net webforms application. Perhaps you've heard "it's the Angular way or the highway". JsViews does this perfectly fine. Vue would probably also have worked for this application.

You'll likely be able to do all you want with any of the frameworks so that's probably a tie.

As for support and bugfixes: JsViews is second to none. We have ran into a couple of issues. All have been fixed in a day or so. The creator is very passionate about this framework. Honestly I think it's easier to get fixes from a smaller framework.

There is going to be more code out there for the big frameworks foresure but I personally don't consider that a big problem. We use bootstrap for our project so most stuff is just writing the correct markup. Where we need to generate said markup dynamically and/or need scripts we encapsulate that stuff in a reusable tag (think component). It means writing some code yourself yes but in my experience reusing someone elses components often leads me to lack features or looks and I'll often spend more time trying to configure that component than it would have taken me to write a custom component myself.

Documentation for JsViews is very complete. Lots of examples too. Vue also has pretty complete documentation and good community support.

I use Vue as well for an other project and it's pretty similar to JsViews in terms of features but I still think JsViews is more powerful once you get to know it and I like JsViews templates more than Vue templates. Also in Vue I feel I have to "configure" my viewmodels more to suit Vue wheras in JsViews I just hand it my viewmodels. In particular I really like the concept of helper methods and converters to separate the view from the model. Basically JsViews feel like a subset of WPF which I personally like.

I feel the basic concept of JsViews is very easy to learn: data bindings, converters, helpers, etc.. Custom tags is somewhat more complicated but not overly so.

If I had to choose a popular framework I would have picked Vue but personally I feel JsViews is more powerful. In case it makes you feel any better my bet is that all these frameworks will be superseded by something else so you might not want to focus blindly on popularity :)

这篇关于JsRender/JsViews与其他基于模板的框架的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆