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 }); 

您可能还需要缩进脚本。 一个档次,如果你想在你的.ct – 图表div。

来源: 如何使用Jade渲染内联JavaScript?