1、安装connect-history-api-fallback,命令:npm install --save connect-history-api-fallback
2、利用node的中间件实现,不影响接口
const history = require('connect-history-api-fallback');
app.use(history());
总结:这样使用的Vue使用history模式,就不会影响到接口,可以进行刷新和前进后退
本文介绍了如何通过安装和配置connect-history-api-fallback中间件,解决Vue.js应用在使用history模式下刷新页面和浏览器前进后退问题。此方法确保接口不受影响,且应用能正常运行。
1、安装connect-history-api-fallback,命令:npm install --save connect-history-api-fallback
2、利用node的中间件实现,不影响接口
const history = require('connect-history-api-fallback');
app.use(history());
总结:这样使用的Vue使用history模式,就不会影响到接口,可以进行刷新和前进后退
589
1157

被折叠的 条评论
为什么被折叠?
