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存儲信息,代碼部署更新之后刷新頁面或者重新打開一個頁面就可以清緩存。