Vue-cli2
config/index.js
只要在dev环境下请求/api,就会被转发到http://localhost:8080/static/mock
module.export {
dev: {
proxyTable: {
'/api': {
target: 'http://localhost:8080',
pathRewrite: {
"^/api": ''/static/mock"
}
}
}
}
}