我正在尝试将脚本放入 Jade 中,但它不允许我使用多个花括号。这是我试图放入 jade 中的图表代码。
body
h1 Crimes by Category
.ct-chart
script(new Chartist.Bar('.ct-chart', {
labels: ['XS', 'S', 'M', 'L', 'XL', 'XXL', 'XXXL'],
series: [20, 60, 120, 200, 180, 20, 10]
}, {
distributeSeries: true
});)
我收到不允许重复属性“{”的消息。我不知道如何解决这个问题。任何帮助,将不胜感激。
最佳答案
要在 Jade 中插入多行 javascript,请使用 script.
标签(脚本内容缩进):
body
h1 Crimes by Category
.ct-chart
script.
new Chartist.Bar('.ct-chart', {
labels: ['XS', 'S', 'M', 'L', 'XL', 'XXL', 'XXXL'],
series: [20, 60, 120, 200, 180, 20, 10]
}, {
distributeSeries: true
});
如果您希望将 script.
缩进 .ct-chart div 中,您可能还需要将它缩进一格。
关于html - Jade 中不允许重复属性 "{",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34504956/