paloalto
V2EX  ›  Node.js

怎么在 Jade 模板的 script 中得到后端 (Express) 传过来的参数?

  •  1
     
  •   paloalto · Jun 4, 2014 · 5177 views
    This topic created in 4426 days ago, the information mentioned may be changed or developed.


    经测试,上面的写法有误,求指正。
    3 replies    2014-06-04 19:13:29 +08:00
    emric
        1
    emric  
       Jun 4, 2014   ❤️ 2
    var test = #{currentMode};

    没有记错的话应该是这样.
    NemoAlex
        2
    NemoAlex  
       Jun 4, 2014   ❤️ 2
    字符串的话可以像 @emric 写的这样,不过要加上引号
    var test = '#{currentMode}';
    其余的类型先转成 JSON 再传吧
    paloalto
        3
    paloalto  
    OP
       Jun 4, 2014
    @emric
    @NemoAlex

    多谢。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2880 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 32ms · UTC 09:26 · PVG 17:26 · LAX 02:26 · JFK 05:26
    ♥ Do have faith in what you're doing.