部署后进入使用ctrl+F5清除浏览器缓存,可以解决
如果不想使用ctrl+F5j解决的话可以考虑以下解决方案:
1、在vue项目中解决
在入口文件index.html添加:
<meta http-equiv="pragram" content="no-cache">
<meta http-equiv="cache-control" content="no-cache, no-store, must-revalidate">
<meta http-equiv="expires" content="0">
2、如果是部署在nginx上
在nginx的配置文件 nginx.config添加:
location = /index.html {
add_header Cache-Control "no-cache, no-store";
}
如果是用nginx做反向代理的,这么加
location = /xx(xx为你的代理的项目名) {
add_header Cache-Control "no-cache, no-store";
}
如果nginx上有 proxy_cache 的配置,也考虑删掉,这是nginx的服务器缓存
nginx服务器缓存机制解析
https://blog.csdn.net/u013032097/article/details/91435268