简体   繁体   中英

parse variable as Jade tag

Is it possible to parse JS variable as Jade tag? What I am trying to achieve is basicaly:

- var tag, numnodes = X
- if (numnodes == 2) tag=".span2"
- else tag=".span3"
tag
 <do something here>

Any help appreciated!

Use interpolation

- var tag = true ? "span" : "div";
#{tag}
  blala

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM