检查小胡子js参数是否为特定值 [英] Check with mustache js if parameter is a specific value
本文介绍了检查小胡子js参数是否为特定值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以在小胡子js中检查特定值,例如{{name}} == "James"
?
Is it possible to check in mustache js for a specific value like {{name}} == "James"
?
数据:
json: {
name: "James"
}
HTML:
{{name}} //Will give me James as output
{{name == "James" }} //Is it possible to check specific value?
推荐答案
否.胡须背后的想法是,它是一种无逻辑的模板语法.因此,不,这样的逻辑是不可能的.
No. The idea behind mustache is that it is a logic-less templating syntax. So, no, such a logic is not possible.
我们称其为逻辑少",因为没有if语句,否则 子句或for循环.相反,只有标签.一些标签是 取而代之的是值,有些什么也没有,而另一些则是一系列的值. https://github.com/janl/mustache.js
We call it "logic-less" because there are no if statements, else clauses, or for loops. Instead there are only tags. Some tags are replaced with a value, some nothing, and others a series of values. https://github.com/janl/mustache.js
这篇关于检查小胡子js参数是否为特定值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文