We're sorry but e-bike doesn't work properly without JavaScript enabled. Please enable it to continue.
We're sorry but e-bike doesn't work properly without JavaScript enabled. Please enable it to continue.
vue-cli搭建的项目,用express模拟后端接口返回数据。我是因为代理端口号没设置对出现过这个问题。express和vue-cli是2个服务,都需要启动,然后配置代理如下:
devServer: {
host: 'localhost',
port: 8080,
proxy: {
'/mock': {
target: 'http://localhost:19021/',
pathRewrite: {
'^/mock': ''
}
}
}
}
app.js:
app.get('/bbb', (req, res) => res.send('Hello World!'))
接口请求:
fetch('/mock/bbb').then()
10 回答11.1k 阅读
15 回答8.4k 阅读
6 回答3k 阅读
5 回答4.8k 阅读✓ 已解决
4 回答3.1k 阅读✓ 已解决
8 回答6.2k 阅读
2 回答2.6k 阅读✓ 已解决
部署的有问题。
你大概用了 history 模式的前端路由。