vue.js 微信开发公众号,页面空白,刷新正常的缓存问题解决办法

当前位置: 首页 » 记录 » vue.js 微信开发公众号,页面空白,刷新正常的缓存问题解决办法

分类: 记录 3542阅读阅读模式

vue.js 开发单页面的微信公众号的时候,更新代码后,访问页面空白,刷新后正常的问题一般是缓存问题,有2个解决办法。

1、客户端添加缓存控制、缓存过期时间

如下代码,添加到vue项目中的 index.htmlhead 中

  1. <meta http-equiv="pragma" content="no-cache"  />
  2. <meta http-equiv="content-type" content="no-cache, must-revalidate" />
  3. <meta http-equiv="Cache-Control" content="no-cache, must-revalidate" />
  4. <meta http-equiv="expires" content="Wed, 26 Feb 2000 11:22:33 GMT"/>

 

2、nginx 服务器添加缓存控制

如下代码,添加到站点的nginx配置中

  1. location / {
  2.   # 解决微信缓存页面配置
  3.   autoindex on;
  4.   add_header Cache-Control "no-store";
  5.   expires -1;
  6.   # 解决微信缓存页面配置 end
  7. }

 

完毕

相关文章

评论一下

相关评论 当前评论 2 条 [ 游客 2 | 博主 0 ]

  1. 聪明勇敢有力气说道:

    这个真的管用吗?