node.js - 按钮未插入 Pug 中的表格行内

标签 node.js pug jade4j

我正在尝试将按钮添加为 Pug 表中的行元素。 但按钮没有插入到特定行 以下是哈巴狗代码

table
    tr#headtag
        th DishName
        th Quantity
        th Currently_Done
        th Predicted
        th 
    each order in orders
        tr
            th=order.dish.name
            th=order.numberOfQuantity
            th=order.dish.predictedValue
            th=order.dish.predictedValue
            th=button(class="btn btn-small", type="button") Slett

在浏览器中收到“某些内容失败错误”

没有按钮代码工作正常。

table
    tr#headtag
        th DishName
        th Quantity
        th Currently_Done
        th Predicted
    each order in orders
        tr
            th=order.dish.name
            th=order.numberOfQuantity
            th=order.dish.predictedValue
            th=order.dish.predictedValue

最佳答案

删除 button 之前的 =classtype 之间的(可选) > 并尝试以下操作:

th
    button(class="btn btn-small" type="button") Slett

来自docs :

Buffered code starts with =. It evaluates the JavaScript expression and outputs the result. For security, buffered code is first HTML escaped.

因此 th=button(class="btn btn-small", type="button") Slett 不起作用。

关于node.js - 按钮未插入 Pug 中的表格行内,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53130922/

相关文章:

javascript - 如何获取 Jade 中的数据

arrays - 在 Pug 中迭代多个数组

javascript - 将post表单值从jade提交到node js

node.js - 流数据事件未注册

node.js - 套接字 : Namespace & WS protocol

node.js - Node.js 中嵌套对象的最大级别是多少?

html - Pug/Jade 条件 AND/&& 语句

javascript - 在 Jade 中内联 Javascript,同时保持缩进

node.js - 为什么li标签没有获取循环变量的值?

json - 如何获取集合中的文档列表,直到 'cost' 字段的总和达到特定值(mongoDb)?