1:同时跑两个服务配置: 1:cnpm i concurrently -D 2:在package.json中。
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"server": "nodemon server.js",
"dev": "concurrently \"npm run serve\" \"npm run server\" "
}
2:跨域问题的配置 axios: 在vue.config.js中配置:
module.exports = {
devServer: {
proxy: { // 跨域 协议 域名 端口
'/api': {
target: "http://localhost:8099/",
ws: true,
changOrigin: true,
pathRewrite: {
'^/api': ''
}
}
}
}
}