zoukankan      html  css  js  c++  java
  • 浏览器返回上一页和上一页页面数据不刷新

    今天写一个vue使用axios的时候,修改完数据后,在使用浏览器的上一页返回去以后的发现页面斌没有变化。

    然后百度了好久找到了,留一下。记录一下。具体什么原理也不知道,就知道管用,就行了。

      $(function () {


                if (window.history && window.history.pushState) {
                    $(window).on('popstate', function () {
                        window.history.pushState('forward', null, '#');
                        window.history.forward(1);
                        location.replace(document.referrer);//刷新 
                    });
                }

                window.history.pushState('forward', null, '#'); //在IE中必须得有这两行
                window.history.forward(1);
    })
  • 相关阅读:
    新的学习计划
    Python学习搬家啦
    安装数据库软件
    oracle11g RAC之grid安装
    PG源码编译安装
    vnc图形化远程centos7.6步骤
    postgresql 日期格式
    centos配置yum源
    pg创建多个实例
    PostgreSQL配置
  • 原文地址:https://www.cnblogs.com/chenyudi/p/12802266.html
Copyright © 2011-2022 走看看