Access VUE data model by another script

Asked

Viewed 98 times

1

Well I have a data model with the following information in vuejs

  graficos: {
     data : {
          labels: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri'],
          series: [
            [5, 2, 4, 2, 0]
          ]
     },

     options : {
         width: 600,
         height: 300
     }, 

in my html page I have this

<div id="app">

  <div class="ct-chart ct-perfect-fourth"></div>

</div>
    <script>
    new Chartist.Line('.ct-chart', this.graficos.data, this.graficos.options);
</script>

but an error occurs " cannot read property 'data' of undefined " how do I access vuejs data models through another script ,

Note: I need to put this new Chartist.Line('.ct-chart', this.graficos.data, this.graficos.options); in my html page because I do not know how to put this method inside the VUE Data Model because if I were to put a method I would have to keep calling him

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.