javascript - 如何在 rivetsJS 中使用 OR 条件
问题描述
如何在 rivetsJS 中使用 OR 条件,同时在 html dom 中绑定它。使用铆钉时,以下代码对我不起作用。当我使用单个条件时它有效
<div rv-class-highlight="view.year || view.month">
</div>
解决方案
我一直在使用格式化程序
rivets.formatters.or = function(value, args) {
return value || args;
};
接着
<div rv-class-highlight="view.year | or view.month">
</div>
推荐阅读
- sybase - 检索密码策略值 SAP ase sybase
- azure - 从自托管 Azure DevOps 代理访问存储在 AzureML Workspace 中的 ML 模型
- r - r 用列表和评估代替
- java - 没有 pom.xml 的 Java Spring Boot 项目
- jenkins - kubectl get secret 从 Jenkins 那里吐出一句废话
- r - Rshiny 中的数据集
- informatica - informatica 云 REST API 内容编码 UTF-8 错误
- javascript - 编写js程序创建map_armstrong函数
- python - python asyncio任务的最大数量是多少
- javascript - 通过模块增强扩展 Material UI 主题无法正常工作