首页 > 在jade属性中如何使用变量?

在jade属性中如何使用变量?

- var blog = { id: 1, title: 'test' }
p
  a(href="/blog/#{blog.id}") #{blog.id} #{blog.title}
p
  a(href="/blog/= blog.id")= blog.title

但结果为:

<p><a href="/blog/#{blog.id}">1 test</a></p>

<p><a href="/blog/= blog.id">1 test</a></p>

不科学啊


- var blog = { id: 1, title: 'test' }
p
  a(href="/blog/" + blog.id) #{blog.id} #{blog.title}

以上。
请参考:
http://jade-lang.com/referenc...
http://jade-lang.com/referenc...

【热门文章】
【热门文章】