jade: if statements and nesting

前端 未结 3 1653
孤街浪徒
孤街浪徒 2021-02-07 07:41

Concider this pseudo-ish server side code

if(isFixed) {
  
} else {
}

Inner element

3条回答
  •  春和景丽
    2021-02-07 08:08

    Jade doesn't seem to have a built in solution to start and end the tags other than utilizing the 'pipe' character to render plain text.

    - if(mode === 'fixed') {
    | 
    - } |

    I cannot get this to be an inner element :(

    - if(mode === 'fixed') { |
    - }

    Less cluttered solution -

    div(class=(isFixed) ? 'fixed' : '')
      p inner element
    

提交回复
热议问题