vue项目报错——$axios is no defined
1、在main.js中加入如下代码:
import axios from 'axios'
Vue.prototype.$axios = axios
2、在app.vue中改成:
this.$axios
.get('http://localhost:8084/demo/user/userList')
.then(response => (this.items = response))
.catch(function (errer) {
console.log(errer)
})