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()
13 回答12.6k 阅读
8 回答6.8k 阅读
7 回答1.6k 阅读
5 回答1.2k 阅读
9 回答1.5k 阅读✓ 已解决
4 回答995 阅读✓ 已解决
3 回答1k 阅读✓ 已解决
部署的有问题。
你大概用了 history 模式的前端路由。