账号密码登录
微信安全登录
微信扫描二维码登录

登录后绑定QQ、微信即可实现信息互通

手机验证码登录
找回密码返回
邮箱找回 手机找回
注册账号返回
其他登录方式
分享
  • 收藏
    X
    location.href和location.reload同时使用的问题?
    27
    0
    let type=item.type,
    url = location.protocol + '//' + location.host + '/web/'+type+'/show.html#/' + this.activity.activity_id+'/'+undefined+'/'+this.yiye.activity_id;
    location.href = url;

    上面type变化时正常跳转页面,只有hash改变时,不会刷新页面,于是我加上下面这句

    location.reload();

    现在hash值变了,上面会刷新页面,但当type改变时 页面却不会跳转了只是刷新了一遍,请问这是什么原因???

    let pathname =location.pathname
    location.href = url;
    if(url.indexOf(pathname)!==-1){
       location.reload();
    }

    最后我是这样解决的,判断路径是否变化来调用reload()

    0
    打赏
    收藏
    点击回答
        全部回答
    • 0
    • 余生浅末 普通会员 1楼
      502 Bad Gateway

      502 Bad Gateway


      nginx
    更多回答
    扫一扫访问手机版
    • 回到顶部
    • 回到顶部