1.npm i axios
2.main.js文件中
import axios from 'axios'
Vue.prototype.$axios = axios
跨域问题
编辑vue.config.js
module.exports = {
devServer: {
proxy: {
'/api': {//发请求时用/api来代替http://39.97.33.178
target: 'http://39.97.33.178',
ws: true,
changeOrigin: true
}
}
}
}