react雕刻网站——rooter原理(7)

  //页面路由

                window.Location.href ="http://www.baidu.com";

                history.back();

                //hash路由

                window.location = 'hash';

                window.onhashchange = function(){

                    this.console.log('current hash:',window.location.hash);

                }

                //h5路由 推进一个状态

                history.pushState('name','title',"/path")

                //替换一个状态

                history.replaceState('name','title',"/path")

                //popstate

                window.onpopstate = function(){

                    console.log(window.location.href)

                }

[email protected]安装


你可能感兴趣的:(react雕刻网站——rooter原理(7))