visionmedia / page.js

Micro client-side router inspired by the Express router
http://visionmedia.github.com/page.js
7.67k stars 687 forks source link

if (hashbang:true).and href has search.This search content is repeated every time it is refreshed #525

Open xiayukun opened 5 years ago

xiayukun commented 5 years ago

This problem is not #! It works fine when there is no #! It will increase ## first! ? * Then replace it, but when it is refreshed again, will there be more? **

ps: http://localhost:3001?*** -> http://localhost:3001/pc/?***#!/bank refreshed http://localhost:3001/pc/?***#!/bank -> http://localhost:3001/pc/?***#!/bank?*** refreshed http://localhost:3001/pc/?***#!/bank?*** -> http://localhost:3001/pc/?***#!/bank?***?***

so My temporary solution is Context.prototype.save = function() { var page = this.page; if (hasHistory && page._window.location.protocol !== 'file:') { page._window.history.replaceState(this.state, this.title, page._hashbang && this.path !== '/' ? '#!' + (this.path.replace(location.search,'')) : this.canonicalPath.replace(location.search,'')); } }; First remove "search" when preparing to add path and canonicalPath

Also hope to have a better solution, thank you, please forgive my English, sorry