[Vuejs]-In created:, my method doesn't work perfectly

0👍

In Vue, you have to draw d3 charts on the mounted hook, rather than the created hook. You can’t draw the chart if the page is not rendered – which is what happens when you use the created hook.

mounted () {
  this.add_svg() // append svg for chart
  this.plot([0, 0]) // basic plot with value = [0, 0]
}

Leave a comment