美文网首页
使用脚手架新建vue项目

使用脚手架新建vue项目

作者: Miley_MOJIE | 来源:发表于2018-11-22 10:30 被阅读0次

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)
})

相关文章

网友评论

      本文标题:使用脚手架新建vue项目

      本文链接:https://www.haomeiwen.com/subject/kkgkqqtx.html