P
P
panikev2020-09-15 11:34:11
Vue.js
panikev, 2020-09-15 11:34:11

Why doesn't Vue write the result to a variable?

Hello! Below I threw off the code that should take data from the backend and write it to the property for the chart. But for some reason this does not happen ... I attach a screen confirming the work of the backend. Please tell me what am I doing wrong?
5f607c3de11f1443077849.jpeg

<template>
  <div id="app">
      {{ this.totalOZON}} // 
       <div id="chart">
    <apexchart width="500" type="bar" :options="chartOptions" :series="series"></apexchart> -->
    </div>
  </div>
</template>
<script>
import axios from "axios";
export default {
  data: () => ({
    totalOZON:[],
     series: [{
            data:  this.totalOZON
             }],
    chartOptions: {},
  }),
    mounted () {
        axios
            .get('http://192.168.1.100:3001/totalOZON')
            .then(response => {
              this.totalOZON  = response.data
              console.log( this.$store.state.total.Hermes)
            });
  },
}
</script>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Pavel Shvedov, 2020-09-15
@panikev

Why in the this. ?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question