vue router

报错:
Uncaught (in promise) DOMException: Failed to execute 'replaceState' on 'History': A history state object with URL 'http:/#/superBookRegister' cannot be created in a document with origin 'http://localhost:9000' and URL 'http://localhost:9000//#/superBookRegister'.

原因:
可能是因为 浏览器中多加了/

例如:
http://localhost:9000//#/superBookRegister

阅读 6.2k
2 个回答

'[http:/#/superBookRegister](http:/#/superBookRegister)'

这个东西就很可疑呀。你是写错了吧。跳转的代码是什么?

这个问题的意思是

未捕获的DOMException:无法在“历史记录”上执行“ replaceState”:无法在源为“ [http://localhost:9000]”的文档中创建URL为“ [http:/#/superBookRegister]”的历史状态对象和网址“ [http://localhost/):9000//#/superBookRegister]”。

这个问题可能是因为url没有加http://前缀导致的
要么在单独网址上加上http://前缀,要么在服务器中间件如nginx,apache上进行处rewrite

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题