1.
在config目录下index.js文件中设置proxyTable:
proxyTable: {
‘/v1‘: {
target: ‘https://api.douban.com‘,
changeOrigin: true,
pathRewrite: {
// /v1将代表target/v1
‘^/v1‘: ‘/v1‘
}
}
}
2.0
2.
因为在新版的vue-cli的package.json中webpack-dev-server没有设置--open,所以打开package.json文件在”scripts”属性中的”dev”属性中手动添加--open,如下代码所示:
"scripts": {
"dev": "webpack-dev-server --open --inline --progress --config build/webpack.dev.conf.js",
"start": "npm run dev",
"build": "node build/build.js"
},
3.0
3.
axios
.get(
"/v1/getServiceInfo?xxxxxx"
)
.then(res => {
console.log(res.data)
})
原文地址:https://www.cnblogs.com/lieaiwen/p/9772927.html
时间: 2024-10-07 19:10:37