admin管理员组文章数量:1530020
首先在index.html中添加meta不缓存
<meta http-equiv="pragram" content="no-cache">
<meta http-equiv="cache-control" content="no-cache, no-store, must-revalidate">
<meta http-equiv="expires" content="0">
然后在vue.config.js里打包时js,css配置时间戳,区别版本
// 打包时添加时间戳,区别版本
const Version = new Date().getTime();
const isPro = process.env.NODE_ENV === 'production'
configureWebpack: {
output: {
filename: `js/[name].${Version}.js`,
chunkFilename: `js/[name].${Version}.js`,
},
},
//其他代码
chainWebpack: (config) => {
// 删除 prefetch 选项: 预加载
config.plugins.delete("prefetch");
if (isPro) {
config.plugin('extract-css').tap((args) => [
{
filename: `css/[name].${Version}.css`,
chunkFilename: `css/[name].${Version}.css`,
},
])
}
//其他代码
},
版权声明:本文标题:vue项目每次更新后清除浏览器缓存 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://m.elefans.com/dianzi/1726723155a1081997.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论