Jade:在多行上声明一个变量 [英] Jade: declare a variable over multiple lines

查看:170
本文介绍了Jade:在多行上声明一个变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个像这样的jade变量:

I have a jade variable declared like this:

BUTTONS = { more_blue: {caption: BUTTONS_CAPTIONS.more, style: BUTTONS_STYLES.blue}, more_red: {caption: BUTTONS_CAPTIONS.more, style: BUTTONS_STYLES.red}, see: {caption: BUTTONS_CAPTIONS.see, style: BUTTON_STYLE_PHOTOS}, see_photos: {caption: BUTTONS_CAPTIONS.see_photos, style: BUTTON_STYLE_PHOTOS}, program : {caption: BUTTONS_CAPTIONS.program, style: BUTTON_STYLE_PROGRAM}, see_program : {caption: BUTTONS_CAPTIONS.see_program, style: BUTTON_STYLE_PROGRAM} }


b $ b

但我想它更可读性如下:

but I would like it to be more readable like this:

BUTTONS = { more_blue: {caption: BUTTONS_CAPTIONS.more, style: BUTTONS_STYLES.blue}
        , more_red: {caption: BUTTONS_CAPTIONS.more, style: BUTTONS_STYLES.red}
        , see: {caption: BUTTONS_CAPTIONS.see, style: BUTTON_STYLE_PHOTOS}
        , see_photos: {caption: BUTTONS_CAPTIONS.see_photos, style: BUTTON_STYLE_PHOTOS}
        , program : {caption: BUTTONS_CAPTIONS.program, style: BUTTON_STYLE_PROGRAM}
        , see_program : {caption: BUTTONS_CAPTIONS.see_program, style: BUTTON_STYLE_PROGRAM}
    }

但此代码无法编译,即使我在每行的结束。是否有任何解决方法?

but this code doesn't compile even if I add backslashes at the end of each line. Are there any workarounds?

推荐答案

Jade现在支持多线变量,如

Jade now supports multineline variables, as described in the docs:

-
  list = ["Uno", "Dos", "Tres",
          "Cuatro", "Cinco", "Seis"]
each item in list
  li= item

这篇关于Jade:在多行上声明一个变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆