如何链接 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/