[Vuejs]-How to pass axios response object from a parent component to child component using props in vue

0👍

There you go

PROSPECT.VUE

    <div class="card-body dashboardContainer">
            <mandate :data="this.sendata"/>
    </div>


export default {
  name: 'prospects',
  components: {
    mandate 
  },
  data() {
       return {
        sendata:{}
      } 
    },
    methods: {
                fetchData(){
                  axios.get('http://localhost:3000/data') .then((response) => {
                  //console.log(response.data);
                  this.sendata=response.data;
                  console.log(this.sendata);

                 })
               .catch(function (error) {
                console.log(error);
                 });
              }
    },
    created(){
    // Fetch Data
    this.fetchData();
}
}

Leave a comment