在url上添加hash值,不跳转页面。可以使用 location.hash = 1 监听: window.onhashchange = function(){ } 当url中的hash值改变时,会触发上面的回调