1//Install Axios
2npm install axios
3
4//Import Axios in .vue file
5import axios from 'axios'
6
7//Add a method to implement Axios
8testMethod () {
9 axios.post('URL')
10 .then(function (response) {
11 alert (response.data);
12 })
13 .catch(function (error) {
14 alert(error);
15 });
16 }
1//Install Axios from terminal
2npm install axios
3//Import Axios in your HelloWorld.vue
4import axios from 'axios'
5//Add a method to implement Axios
6test () {
7 axios.post('URL')
8 .then(function (response) {
9 alert (response.data);
10 })
11 .catch(function (error) {
12 alert(error);
13 });
14 }
1<ul>
2 <li v-for="food in foods">
3 <h2>{{food.name}}</h2>
4 <ul>
5 <li v-for="nutrient in food.nutrients">{{nutrient.nutrient_id}}</li>
6 </ul>
7 </li>
8</ul>
9
10
11axios.get(url).then(response => {
12 this.foods = response.data.report.foods
13})