有3个条件的苗条条件班 [英] Conditional class in slim with 3 conditions

查看:57
本文介绍了有3个条件的苗条条件班的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想用苗条的方式编写条件类,但我只知道如何使用2个条件来完成它,例如:

I would like to write conditional class in slim but I only know how to do it with 2 conditions, like :

div class=(index == 0 ? 'class1' : 'class1 class3')

如何在三个条件下做到这一点?

How to do it with three conditions?

- if index == 0
  .class1
- elsif index == -1
  .class2.class3
- else
  .class1.class3

推荐答案

div class=(if index == 0 then 'class1' elsif index == -1
then 'class2 class3' else '.class1 class3' end)

这篇关于有3个条件的苗条条件班的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆