公司产品较多,涉及到不同站点相互跳转传参,携带的参数使用后不删除便会重复渲染,目前想到的办法就是第一次执行成功后就移除location.search;
使用 history.pushState(state, title [, url]) 方法,向浏览器的会话历史记录堆栈中添加记录。
if(location
.search
){
history
.pushState('','',location
.href
.split('?')[0]);
}
文档 https://developer.mozilla.org/en-us/docs/web/api/history/pushstate 流程图 https://www.processon.com/view/link/5ff556b9e0b34d34e1315bde
如果有更改好的建议,欢迎在下方留言。