vue-admin-template地址栏刷新或F5刷新返回404或空白的问题
·
vue-admin-template刷新的时候会遇到404或空白的问题,这个问题是因为开启了history模式
但是后台的nginx或apache并没有支持,这时把后台nginx或apache加上就可以了
#nginx
location / {
try_files $uri $uri/ /index.html;
}
#apache
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.html [L]
</IfModule>
这样就可以了,这部分内容在官网上也有,
如果后端不支持的话,就只能禁用history模式了,把mode屏蔽了就可以了
魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。
更多推荐


所有评论(0)