vue版本更新index.html缓存
<head> <meta charset="utf-8"> <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="X-UA-Compatible" content="IE=edge"> <meta content="black" name="apple-mobile-web-app-status-bar-style"> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0,user-scalable=no"> <link rel="icon" href="./favicon.ico" type="image/x-icon"/> <meta name="format-detection" content="telephone=yes"/> <title>xxx</title> </head>
https://blog.csdn.net/u012375924/article/details/82806617 详情解说
在 index.html 页面前面加 meta 标签,注意:记得加上,我就是忘记加上了,一直测试不过。
1 <meta http-equiv="pragram" content="no-cache"> 2 <meta http-equiv="cache-control" content="no-cache, no-store, must-revalidate"> 3 <meta name="viewport" content="width=device-width,initial-scale=1.0">
但是把打包好的index.html放到服务器里去的时候,index.html在服务器端可能是有缓存的,这需要在服务器配置不让缓存index.html
nginx 配置如下:
location = /index.html {
add_header Cache-Control "no-cache, no-store";
}