zoukankan      html  css  js  c++  java
  • spa 单页面解决浏览器back front 问题

    1.angular router

      reloadOnSearch:true(default) | false

        默认为true,当url的hash发生改变,页面新渲染,component会重新加载(初始化);

        false,当url的hash发生改变,页面不重新渲染,component不会重新加载(初始化);

    2.改变url的hash

      window.history.pushState({}, null, '?tab=home');改方法可以直接改变url的hash,并加入history;

    当前url为http://localhost:8888
    执行前:
    http://localhost:8888
    window.history.pushState({}, null, '?tab=home');
    执行后:
    http://localhost:8888?tab=home

         window.location.hash 取或者设置url的hash值,直接在url上面加入hash:

    当前url为http://localhost:8888
    执行前:http://localhost:8888
    window.location.hash = 'name=test';
    执行后:http:
    //localhost:8888?tab=home#name=test

         window.location.search 取或者url 通过pushState的值,方法类似window.history.pushState({}, null, '?tab=home');

     
  • 相关阅读:
    HTTP
    nginx反向代理和负载均衡
    keepalive
    lnmp
    DNS
    jumpserver跳板机
    博客已搬家到CSDN
    JAVA中关于上传图片到数据库和从数据库取出显示图片的问题
    checkbox的标签和全选中问题
    SOCKET
  • 原文地址:https://www.cnblogs.com/rengised/p/6248525.html
Copyright © 2011-2022 走看看