<button @click="buttonClick"></button>

//点击事件

buttonClick(){
  window.history.replaceState({index: 2}, null, window.location.href)
  //window.history.pushState({index: 2}, null, window.location.href)
  this.$router.push({name: 'parsem'})
}
//默认事件
window.onpopstate = function (params) {
  console.log('location: ' + document.location);
  console.log('state: ' + params.state);
}
//或者一下
// window.addEventListener('popstate', function (params) {
//   console.log(params.state)
// })

相关文章:

  • 2022-12-23
  • 2021-11-24
  • 2022-01-22
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-02-05
  • 2022-12-23
猜你喜欢
  • 2021-06-29
  • 2021-09-27
  • 2021-12-31
  • 2022-12-23
  • 2022-12-23
  • 2021-11-28
  • 2021-12-03
相关资源
相似解决方案