方法 1.index.html 文件里面配置
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Expires" content="0" />
方法 2.H5入口拼接随机参数
格式:http:XXXXX?随便字段名=随机数
eg.
const Timestamp = new Date().getTime();
window.location.href=`https://juejin.cn/post/7225534193996349496?Timestamp=${Timestamp}`
方法 3.在config里面给js,css配置时间戳
在module.exports里面使用,output配置,如下所示
const Timestamp = new Date().getTime();
module.exports = defineConfig({
publicPath: "",
configureWebpack: {
output: {
filename: `js/[name].${Timestamp}.js`,
chunkFilename: `js/[name].${Timestamp}.js`,
},
},
})