问题
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?
回答1:
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 :)
来源:https://stackoverflow.com/questions/57261992/jsrender-jsviews-vs-other-template-based-frameworks