Unused definition $axios
在man.js中做了这些
import Vue from 'vue'
import App from './App'
import router from './router'
// 设置反向代理前端请求默认发送到localhost8443
var axios = require('axios')
// import axios from 'axios'
axios.default.baseURL = 'http://localhost:8443/api'
// 全局注册,之后可在其他组件中通过this.$axios发送数据
Vue.prototype.$axios = axios
Vue.config.productionTip = false
login.vue
methods: {
login () {
this.$axios
.post('/login', {
username: this.loginForm.username,
password: this.loginForm.password
})
这里的$axios为什么是点不出post方法的,即便打上这个函数在前端访问页面的时候也会出404
Failed to load resource: the server responded with a status of 404 (Not Found)