1.先全局安装vue-cli3.0
2.创建项目
原文:https://blog.youkuaiyun.com/qq_36407748/article/details/80739787
原文:https://blog.youkuaiyun.com/weiwenwen6/article/details/83120115
3.使用
cli3.0启动npm run serve
在package.json中加这句可以用cli2.0的启动命令npm run dev
在跟目录下创建vue.config.js文件
module.exports = {
devServer: {
port: 8080,
proxy: {
'/api': {
target: '<url>', // target host
ws: true, // proxy websockets
changeOrigin: true, // needed for virtual hosted sites
pathRewrite: {
'^/api': '' // rewrite path
}
},
}
}
}