1.在index.html頭部添加如下代碼:
<meta http-equiv="pragram" content="no-cache"> <meta http-equiv="cache-control" content="no-cache, no-store, must-revalidate">
2.在vue.config.js中添加如下代碼:
const Timestamp = new Date().getTime(); module.exports = { configureWebpack: { // webpack 配置 output: { // 輸出重構 打包編譯后的 文件名稱 【模塊名稱.版本號.時間戳】 filename: `static/js/[name].${process.env.VUE_APP_Version}.${Timestamp}.js`, chunkFilename: `static/js/[name].${process.env.VUE_APP_Version}.${Timestamp}.js` }, }, ... }
3.在nginx.conf頁面添加如下代碼:
location = /index.html {
add_header Cache-Control "no-cache, no-store";
}