不推荐使用 jQuery 模板?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7911732/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-27 00:26:32  来源:igfitidea点击:

jQuery Templates are deprecated?

jquerytemplatesjquery-templates

提问by JJO

I see that per the jQuery plugin template pagethat jQuery plugins have gone from beta to deprecated without passing a real release. I can't find any info on jquery.com or their related sites about why. Or when a replacement might be available. Maybe 1.8?

我看到根据jQuery 插件模板页面,jQuery 插件已经从测试版变为不推荐使用,而没有通过真正的发布。我在 jquery.com 或其相关网站上找不到任何关于原因的信息。或者当可能有替代品时。可能是 1.8?

This is very frustrating because my project has made a big investment in jQuery templates. Now it looks like a bad investment and we're looking for something else that is jQuery-based, including JavascriptMVC.

这很令人沮丧,因为我的项目在 jQuery 模板上进行了大量投资。现在它看起来像是一笔糟糕的投资,我们正在寻找其他基于 jQuery 的东西,包括 JavascriptMVC。

Any better suggestions? I'll be happy to take rationale or other information in the comments, but I'd prefer suggestions as answers.

有什么更好的建议吗?我很乐意在评论中提供理由或其他信息,但我更喜欢建议作为答案。

采纳答案by Alex Sexton

jQuery Templates are not dead, they just aren't going in as an official template language of the project. The maintainer of that project will likely still make some updates (and has plans to redo quite a bit of it in the future).

jQuery 模板并没有消亡,它们只是没有作为项目的官方模板语言出现。该项目的维护者可能仍会进行一些更新(并计划在未来重做很多)。

JavaScriptMVC is quite a bit more complex than just templates and you can use just about any templating language that you want with it.

JavaScriptMVC 比模板复杂得多,你可以使用任何你想要的模板语言。

Some of the more popular templating languages these days are Mustache/Handlebars, Dust.js, Haml, Embedded JavaScript, and a few others. The first three are actually pretty similar syntax to the jQuery templates with the exception that they don't natively create jQuery object for your element. That's easy to add though.

目前比较流行的模板语言有Mustache/ HandlebarsDust.jsHamlEmbedded JavaScript和其他一些。前三个实际上与 jQuery 模板的语法非常相似,不同之处在于它们本身不会为您的元素创建 jQuery 对象。不过这很容易添加。

回答by Tariqulazam

I think this post can give you some insight and possibly some food for thought. http://www.borismoore.com/2011/10/jquery-templates-and-jsviews-roadmap.html

我认为这篇文章可以为您提供一些见解,并可能为您提供一些思考。 http://www.borismoore.com/2011/10/jquery-templates-and-jsviews-roadmap.html

回答by David Titarenco

Yes, a lot of people are pissed offabout the abandonment of jQuery Templates (among other things). On the bright side, some sort of templating will be implemented in the new jQuery UI (not sure if this is out yet or not). Your best bet is to look for an alternative templating engine.

是的,很多人对放弃 jQuery 模板(除其他外)感到恼火。好的一面是,某种模板将在新的 jQuery UI 中实现(不确定是否已经发布)。最好的办法是寻找替代的模板引擎。

A comparison table is provided on the jQuery wiki.

jQuery wiki上提供了一个比较表。

回答by steady_daddy

I have used both jQuery template as well as handlebars. IMHO, handlebars is way better than jquery template in terms of usage, clarity of code and speed. Handlebars pre-compiled templates load really fast on various browsers comparatively. Check out this link for comparison of different templating engines: http://jsperf.com/jquery-template-table-performance/134

我使用过 jQuery 模板和把手。恕我直言,handlebars 在用法、代码清晰度和速度方面比 jquery 模板好得多。相比之下,Handlebars 预编译模板在各种浏览器上的加载速度非常快。查看此链接以比较不同的模板引擎:http: //jsperf.com/jquery-template-table-performance/134