https://www.jianshu.com/p/4eecd628782a
1、安装cnpm时出现没有权限的情况
vim ~/.npm-config
npm config set prefix '~/.npm-global'
export PATH=~/.npm-global/bin:$PATH
source~/.npm-config
2、使用axios发送http请求,跨域问题
在config/index.js的proxyTable中添加
proxyTable: {
'/job': {
target: 'http://ip:端口号/',
changeOrigin: true,
pathRewrite: {
'^/job': ''
},
}
}
并在请求时
axios({
method: 'get',
baseURL: '/job/projects.json'
}).then(res => {
this.projects = res
console.log(res)
})