简体   繁体   中英

this code is showing error in jade

This Jade code isn't working.

head
    script(src='http://d3js.org/d3.v3.min.js')
    script(src='http://dimplejs.org/dist/dimple.v2.1.0.min.js')

body
    script(type='text/javascript')
        var svg = dimple.newSvg("body", 800, 600);
        var data = [
        { "Word":"Hello", "Awesomeness":2000 },
        { "Word":"World", "Awesomeness":3000 }
        ];
        var chart = new dimple.chart(svg, data);
        chart.addCategoryAxis("x", "Word");
        chart.addMeasureAxis("y", "Awesomeness");
        chart.addSeries(null, dimple.plot.bar);
        chart.draw();

As of version 1.0.0 of Jade, you must include a . to make script tags be text:

body
    script(type='text/javascript').
        // above here
        var svg = dimple.newSvg("body", 800, 600);
        var data = [
        { "Word":"Hello", "Awesomeness":2000 },
        { "Word":"World", "Awesomeness":3000 }
        ];
        var chart = new dimple.chart(svg, data);
        chart.addCategoryAxis("x", "Word");
        chart.addMeasureAxis("y", "Awesomeness");
        chart.addSeries(null, dimple.plot.bar);
        chart.draw();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM