[英]How to use OR condition in rivetsJS
How to use OR condition in rivetsJS while binding it in html dom. 在html dom中绑定它时如何在rivetsJS中使用OR条件。 The below code does not work for me while using rivets.
以下代码在使用铆钉时对我不起作用。 It works when i use a single condition
当我使用单个条件时它起作用
<div rv-class-highlight="view.year || view.month">
</div>
I have been using a formatter 我一直在使用格式化程序
rivets.formatters.or = function(value, args) {
return value || args;
};
And then 接着
<div rv-class-highlight="view.year | or view.month">
</div>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.