1.在index.html文件 head代码块中添加下面👇代码
<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" />
<meta http-equiv="Cache" content="no-cache" />
script中添加
<script>
var now = new Date();
var number = now.getYear().toString() + now.getMonth().toString() + now.getDate().toString() + now.getHours().toString() + now.getMinutes().toString() + now.getSeconds().toString();
document.write('<scr' + 'ipt type="text/javascript" src="js/config.js?v='+number+'"></scr' + 'ipt>');
</script>
2.在路由配置文件中(我这是config.js文件)templateUrl中添加时间戳
.state('ydthlife.QRCode', {
url: "/QRCode",
templateUrl: 'views/ydthlife/QRCode/QRCode.html?time=' + new Date().getTime(),
data: { pageTitle: '' }, //页面标题
controller: 'QRCodeCtrl',
resolve: {
loadPlugin: function ($ocLazyLoad) { //懒加载controller
return $ocLazyLoad.load([
{
files: [
'views/ydthlife/QRCode/QRCode.js?v=' + new Date().getTime(),
'views/ydthlife/QRCode/QRCode.css?v=' + new Date().getTime()
]
},
]);
}
}
})