Answers for "axios in vue"

12

axios in vue

//Install Axios
npm install axios

//Import Axios in .vue file
import axios from 'axios'

//Add a method to implement Axios
testMethod () {
      axios.post('URL')
      .then(function (response) {
        alert (response.data);
      })
      .catch(function (error) {
        alert(error);
      });
    }
Posted by: Guest on August-03-2020
2

install vue axios

npm install --save vue-axios
Posted by: Guest on June-19-2021
1

how to use axios in vue

//Install Axios from terminal
npm install axios
//Import Axios in your HelloWorld.vue
import axios from 'axios'
//Add a method to implement Axios
test () {
      axios.post('URL')
      .then(function (response) {
        alert (response.data);
      })
      .catch(function (error) {
        alert(error);
      });
    }
Posted by: Guest on May-11-2020
0

vuejs list items from axios

<ul>
    <li v-for="food in foods">
        <h2>{{food.name}}</h2>
        <ul>
              <li v-for="nutrient in food.nutrients">{{nutrient.nutrient_id}}</li>
        </ul>
    </li>
</ul>


axios.get(url).then(response => { 
    this.foods = response.data.report.foods
})
Posted by: Guest on July-27-2020
0

how to use api url in vue

<a :href="post.url" target="_blank"><img :src="post.image_url"></a>
Posted by: Guest on March-19-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language