vue打包之后放在后端,部署上线后刷新页面后显示token身份认证失效

vue打包之后放在后端,部署上线后刷新页面后显示token身份认证失效

解决办法

前端:

在vue-router中mode设置路由history

mode:'history',

在这里插入图片描述

后端:

使用中间件 connect-history-api-fallback

//下载中间件
npm install --save connect-history-api-fallback



var history = require('connect-history-api-fallback');
app.use(history());

在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/weixin_45822938/article/details/123716013
今日推荐