zoukankan      html  css  js  c++  java
  • Jade之Case

    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>
    
  • 相关阅读:
    Gitbook
    Docker命令
    sd
    文本三剑客
    2017.4.12下午
    2017.4.11下午
    2017.4.11上午
    2017.4.10下午
    2017.4.10上午
    2017.4.7下午
  • 原文地址:https://www.cnblogs.com/wsy06/p/4986176.html
Copyright © 2011-2022 走看看