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存储信息,代码部署更新之后刷新页面或者重新打开一个页面就可以清缓存。

相关文章: