1.nginx服务器缓存解决方案
location ~.*\.(js|css|html|png|jpg)$ { add_header Cache-Control no-cache no-store; } 禁止一切缓存
2.vue本地缓存解决方案
(1)在入口HTML文件加上(不推荐,带宽小会加载卡顿)
<meta http-equiv="pragram" content="no-cache"> <meta http-equiv="cache-control" content="no-cache, no-store, must-revalidate"> <meta name="viewport" content="width=device-width,initial-scale=1.0">
(2)打包文件命名唯一
const version = new Date().getTime();
output: {
path: config.build.assetsRoot,
filename: utils.assetsPath('js/[name].[chunkhash:8].' + version + '.js'),
chunkFilename: utils.assetsPath('js/[name].[chunkhash:8].' + version + '.js')
}
Comments NOTHING