[Vuejs]-How to use the vegaEmbed function inside a loop passing element ids dynamically generated through a v-for?

0๐Ÿ‘

โœ…

  • It should be this.possibleCharts instead of possibleCharts
  • If possibleCharts is load asynchronously, you should watch this value and render after that using $nextTick. Thanks.
watch: {
  possibleCharts() {
    this.$nextTick(() => {
      for (let i = 0; i < this.possibleCharts.length; i++) {
        vegaEmbed("#chart" + i, this.possibleCharts[i].spec);
      }
    })
  }
}

Hope this will help.

Leave a comment