问题
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
回答1:
div class=(if index == 0 then 'class1' elsif index == -1
then 'class2 class3' else '.class1 class3' end)
来源:https://stackoverflow.com/questions/40591084/conditional-class-in-slim-with-3-conditions