Case
jade中的case类似js中的switch语句。
当前一个when中无语句的时候,将一直往下直至遇到一个有语句的when才跳出。
jade:
case friends
  when -1 //- 执行when 1中的语句
  when 0
    p you have no friends
  when 1
    p you have a friend
  default
    p you have #{friends} friends
html:
<p>you have 10 friends</p>
case还有另外一种写法。注意:后需接一个空格,后面内容若换行会报错。
jade:
- var friends = 1
case friends
  when 0: p you have no friends
  when 1: p you have a friend
  default: p you have #{friends} friends
html:
<p>you have a friend</p>
 
                    
                     
                    
                 
                    
                 
 
                
            
         浙公网安备 33010602011771号
浙公网安备 33010602011771号