[Vuejs]-TypeError: this.axios is undefined

2👍

On app.js, use

window.axios = require("axios");
// instead of
import axios from 'axios';
Vue.use(axios);

on Vue files, use like this:

axios.get(...)
👤Bulent

3👍

Inside app.js add this line of code:

Vue.prototype.axios = axios;

After this statement, you can use this.axios inside every Vue component

Leave a comment