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";
}版权声明:本文为yinge0508原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。