【Vue实用功能】Vue中H5页面缓存解决方案

前言

每次更新H5页面的时候,都需要刷新或者清楚缓存,才能加载到最新的代码,这大大降低了用户的体验

使用:

npm i webpack-merge

import merge from 'webpack-merge';

mounted() {
    
    
      if (!this.$route.query || !this.$route.query.timestamp) {
    
    
        this.$router.push({
    
    
          query: merge(this.$route.query, {
    
    
            'timestamp': new Date().getTime()
          })
        })
        setTimeout(function () {
    
    
          location.reload();
        }, 300);
      }
 }

猜你喜欢

转载自blog.csdn.net/weixin_44590591/article/details/127490777