如何加载我的数据从axios在social-box-chart-example:laravel中的data

时间:2018-08-21 13:02:12

标签: laravel vue.js

我从user_chart_data获得了axios.get('api/get_data')

user_chart_data = [35, 23, 56, 22, 97, 23, 64,0,0,0,0,0]

但是我无法以HTML加载数据。

这是代码:

<template>
  <div class="animated fadeIn">
   <div class="row">
    <div class="col-sm-8 col-lg-4">
      <div class="social-box facebook">
        <i class="fa fa-group"></i>
        <div class="chart-wrapper">
         <social-box-chart-example :data="user_chart_data" height="90"/>
        </div> 
      </div><!--/.social-box-->
     </div><!--/.col-->
   </div>
 </div>
</template>



<script>
    export default {
       data: function() {
           return {
            user_chart_data: [],
          }
        },
       mounted(){
        var app = this;
        axios.get('api/get_data')
        .then((response)=> {        
         app.user_chart_data = response.data.user_chart_data;        
         console.log(app.user_chart_data);
         })
        .catch((error)=>{
            console.log(error);
        })
      }
   }
</script>

0 个答案:

没有答案