Jade Inline Conditional

后端 未结 7 1828
你的背包
你的背包 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:19

    You can to use, not only class, but a bunch of attributes in a conditional way:

    - each sense, i in entry.senses
      - var attrs = i === 0 ? {'disabled': 'true'} : {'class': '100', 'ng-model': 'vm.model.name', 'ng-click': 'vm.click()'}
      div&attributes(attrs)
    

提交回复
热议问题