pug - jade 模板引擎带有按钮的 href 标签

标签 pug

如何链接 Jade 模板中的按钮?我正在尝试生成 HTML

<a href="create"><button type="button">create new post</button></a>

我试过
a(href="create") button "create new post"

这导致
<a href="create">button "create new post"</a>

如果我把它改成
a(href="create")button "create new post"

我收到错误
logJs\views\posts\update.jade:7 5| block content 6| h1='creating new post' > 7| a(href="create")button "hello word" 8| form(name="add-post",method="post") 9| div.input 10| span.label title Unexpected token `tag` expected `text`, `code`, `:`, `newline` or `eos`

最佳答案

您只需要使用单独的行和正确的缩进。 Jade 码

a(href="create")
   button(type="button") create new post

结果是
<a href="create"><button type="button">create new post</button></a>

关于pug - jade 模板引擎带有按钮的 href 标签,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36233833/

相关文章:

node.js - Jade 在输出中添加撇号

node.js - pug 在输入中嵌套内容

javascript - Sails JS 链接器 : Compiling JADE templates

css - 输入 :focus icon color change not working

node.js - 切换事件链接 Bootstrap 导航栏

css - Bootstrap 的字形输入字段未对齐

html - Pug-Template 不导入 CSS

javascript - != 在 jade/pug 中做什么?

node.js - Backbone.js - 修改已经呈现的页面

javascript - Node Jade 意外字符 # expected ` ` , `\n` , `,` , `!` or `=`