Jade Inline Conditional

后端 未结 7 1599
你的背包
你的背包 2021-01-31 15:43

I\'m trying to make everything apart from the first element in an array have a CSS class using the Jade templating engine.

I was hoping I could do it like this, but no l

7条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-31 16:26

    You can do this instead:

    - each sense, i in entry.senses
      - var klass = (i === 0 ? 'span13' : 'span13 offset3')
      div(class=klass)
        ... a tonne of subsequent stuff
    

提交回复
热议问题