vue项目,代码部署之后,如何解决浏览器存在缓存问题

1.在index.html头部添加如下代码:

<meta http-equiv="pragram" content="no-cache">
<meta http-equiv="cache-control" content="no-cache, no-store, must-revalidate">

2.在nginx.conf页面添加如下代码:

location = /index.html {
    add_header Cache-Control "no-cache, no-store";
}

 3.在开发中使用sessionStorage而不是localStorage存储信息,代码部署更新之后刷新页面或者重新打开一个页面就可以清缓存。

posted @ 2020-03-23 15:47  水迹仙涯  阅读(4471)  评论(0编辑  收藏  举报