{"id":2514,"date":"2020-03-27T15:27:29","date_gmt":"2020-03-27T07:27:29","guid":{"rendered":"http:\/\/www.yuguoxy.com\/geekhome\/?p=2514"},"modified":"2020-03-27T15:31:00","modified_gmt":"2020-03-27T07:31:00","slug":"%e4%b8%a4%e7%a7%8d%e5%89%8d%e7%ab%af%e8%b7%af%e7%94%b1%ef%bc%88hash%e6%a8%a1%e5%bc%8f%e5%92%8chistory%e6%a8%a1%e5%bc%8f%ef%bc%89%e5%ae%9e%e7%8e%b0%e5%8e%9f%e7%90%86%e8%a7%a3%e6%9e%90%e5%8f%8a%e5%8c%ba","status":"publish","type":"post","link":"https:\/\/ai.zhousir.top\/?p=2514","title":{"rendered":"\u4e24\u79cd\u524d\u7aef\u8def\u7531\uff08hash\u6a21\u5f0f\u548chistory\u6a21\u5f0f\uff09\u5b9e\u73b0\u539f\u7406\u89e3\u6790\u53ca\u533a\u522b"},"content":{"rendered":"<p>\u76ee\u524d\u5355\u9875\u5e94\u7528\uff08SPA\uff09\u8d8a\u6765\u8d8a\u6210\u4e3a\u524d\u7aef\u4e3b\u6d41\uff0c\u5355\u9875\u5e94\u7528\u4e00\u5927\u7279\u70b9\u5c31\u662f\u4f7f\u7528\u524d\u7aef\u8def\u7531\uff0c\u7531\u524d\u7aef\u6765\u76f4\u63a5\u63a7\u5236\u8def\u7531\u8df3\u8f6c\u903b\u8f91\uff0c\u800c\u4e0d\u518d\u7531\u540e\u7aef\u4eba\u5458\u63a7\u5236\uff0c\u8fd9\u7ed9\u4e86\u524d\u7aef\u66f4\u591a\u7684\u81ea\u7531\u3002<\/p>\n<p>\u76ee\u524d\u524d\u7aef\u8def\u7531\u4e3b\u8981\u6709\u4e24\u79cd\u5b9e\u73b0\u65b9\u5f0f\uff1ahash\u6a21\u5f0f\u548chistory\u6a21\u5f0f\uff0c\u4e0b\u9762\u5206\u522b\u8be6\u7ec6\u8bf4\u660e\u3002<\/p>\n<h3>hash\u6a21\u5f0f<\/h3>\n<p>\u8fd9\u4e2a\u6211\u4eec\u5e94\u8be5\u4e0d\u964c\u751f\uff0c\u6bd4\u5982\u5728\u7528\u8d85\u94fe\u63a5\u5236\u4f5c\u951a\u70b9\u8df3\u8f6c\u7684\u65f6\u5019\uff0c\u5c31\u4f1a\u53d1\u73b0\uff0curl\u540e\u9762\u8ddf\u4e86&quot;#id&quot;\uff0chash\u503c\u5c31\u662furl\u4e2d\u4ece&quot;#&quot;\u53f7\u5f00\u59cb\u5230\u7ed3\u675f\u7684\u90e8\u5206<\/p>\n<pre><code class='language-js' lang='js'>\/\/\u7eb7\u4eab\u9500\u5ba2\u7cfb\u7edf\u91c7\u53d6\u7684\u5c31\u662fhash\u6a21\u5f0f\r\n \r\nhttps:\/\/www.fxiaoke.com\/XV\/Home\/Index#plan\r\n \r\nhttps:\/\/www.fxiaoke.com\/XV\/Home\/Index#approve\r\n \r\nhttps:\/\/www.fxiaoke.com\/XV\/Home\/Index#crm\/index\r\n<\/code><\/pre>\n<p>hash\u503c\u53d8\u5316\u6d4f\u89c8\u5668\u4e0d\u4f1a\u91cd\u65b0\u53d1\u8d77\u8bf7\u6c42\uff0c\u4f46\u662f\u4f1a\u89e6\u53d1window.hashChange\u4e8b\u4ef6\uff0c\u5047\u5982\u6211\u4eec\u5728hashChange\u4e8b\u4ef6\u4e2d\u83b7\u53d6\u5f53\u524d\u7684hash\u503c\uff0c\u5e76\u6839\u636ehash\u503c\u6765\u4fee\u6539\u9875\u9762\u5185\u5bb9\uff0c\u5219\u8fbe\u5230\u4e86\u524d\u7aef\u8def\u7531\u7684\u76ee\u7684\u3002<\/p>\n<h4>1. \u5b9e\u73b0\u539f\u7406:<\/h4>\n<pre><code class='language-js' lang='js'>\/\/\u6253\u5f00\u6d4f\u89c8\u5668\u63a7\u5236\u53f0\u6267\u884c\u5982\u4e0b\u4ee3\u7801\r\nwindow.onhashchange = () =&gt; {\r\n    console.log(&#39;hash :&#39;,location.hash);\r\n    switch (location.hash) {\r\n        case &#39;#index&#39;:\r\n            console.log(&#39;index&gt;&gt;&gt;&gt;&#39;);\r\n            break\r\n        case &#39;#news&#39;:\r\n             console.log(&#39;news&gt;&gt;&gt;&gt;&#39;);\r\n            break\r\n        default:\r\n            console.log(&#39;404&gt;&gt;&gt;&gt;&#39;);\r\n    }\r\n}\r\nlocation.hash = &#39;#index&#39;\r\n\r\nlocation.hash = &#39;#news&#39;\r\n \r\nlocation.hash = &#39;#other&#39;\r\n\r\n \r\n\r\n<\/code><\/pre>\n<h4>2. \u5229\u7528hash\u5b9e\u73b0\u9875\u9762\u53d8\u5316<\/h4>\n<p>html\uff1a\u83dc\u5355\u4e2dhref\u8bbe\u7f6e\u4e3ahash\u5f62\u5f0f\uff0cid\u4e3aapp\u4e2d\u653e\u7f6e\u9875\u9762\u5185\u5bb9<\/p>\n<pre><code class='language-html' lang='html'>&lt;ul id=&quot;menu&quot;&gt;\r\n    &lt;li&gt;\r\n        &lt;a href=&quot;#index&quot;&gt;\u9996\u9875&lt;\/a&gt;\r\n    &lt;\/li&gt;\r\n    &lt;li&gt;\r\n        &lt;a href=&quot;#news&quot;&gt;\u8d44\u8baf&lt;\/a&gt;\r\n    &lt;\/li&gt;\r\n    &lt;li&gt;\r\n        &lt;a href=&quot;#user&quot;&gt;\u4e2a\u4eba\u4e2d\u5fc3&lt;\/a&gt;\r\n    &lt;\/li&gt;\r\n \r\n&lt;\/ul&gt;\r\n \r\n&lt;div id=&quot;app&quot;&gt;&lt;\/div&gt;\r\n<\/code><\/pre>\n<p>js\uff1a\u5728window.onhashchange\u4e2d\u83b7\u53d6hash\u503c\uff0c\u6839\u636e\u4e0d\u540c\u7684\u503c\uff0c\u4fee\u6539app\u4e2d\u4e0d\u540c\u7684\u5185\u5bb9\uff0c\u8d77\u5230\u4e86\u8def\u7531\u7684\u6548\u679c<\/p>\n<pre><code class='language-js' lang='js'>function hashChange(e){\r\n    \/\/ console.log(location.hash)\r\n    \/\/ console.log(location.href)\r\n    \/\/\r\n    \/\/ console.log(e.newURL)\r\n    \/\/ console.log(e.oldURL)\r\n \r\n    let app = document.getElementById(&#39;app&#39;)\r\n \r\n    switch (location.hash) {\r\n        case &#39;#index&#39;:\r\n            app.innerHTML = &#39;&lt;h1&gt;\u8fd9\u662f\u9996\u9875\u5185\u5bb9&lt;\/h1&gt;&#39;\r\n            break\r\n        case &#39;#news&#39;:\r\n            app.innerHTML = &#39;&lt;h1&gt;\u8fd9\u662f\u65b0\u95fb\u5185\u5bb9&lt;\/h1&gt;&#39;\r\n            break\r\n        case &#39;#user&#39;:\r\n            app.innerHTML = &#39;&lt;h1&gt;\u8fd9\u662f\u4e2a\u4eba\u4e2d\u5fc3\u5185\u5bb9&lt;\/h1&gt;&#39;\r\n            break\r\n        default:\r\n            app.innerHTML = &#39;&lt;h1&gt;404&lt;\/h1&gt;&#39;\r\n    }\r\n}\r\n \r\nwindow.onhashchange = hashChange\r\n \r\nhashChange()\r\n<\/code><\/pre>\n<p>\u8fd9\u6837\u6211\u4eec\u5c31\u5b9e\u73b0\u4e86\u4e00\u4e2a\u7b80\u5355\u7684hash\u8def\u7531\u3002<\/p>\n<h3>history\u6a21\u5f0f<\/h3>\n<p>hash\u6a21\u5f0f\u770b\u8d77\u6765\u662f\u6bd4\u8f83\u4e11\u7684\uff0c\u90fd\u5e26\u4e2a&quot;#&quot;\u53f7\uff0c\u6211\u4eec\u4e5f\u53ef\u4ee5\u91c7\u53d6history\u6a21\u5f0f\uff0chistory\u5c31\u662f\u6211\u4eec\u5e73\u65f6\u770b\u5230\u7684\u6b63\u5e38\u7684\u8fde\u63a5\u5f62\u5f0f<\/p>\n<pre><code class='language-js' lang='js'>https:\/\/47.109.74.84#plan\/index  \/\/hash\u6a21\u5f0f\u8def\u7531 \r\n \r\nhttps:\/\/47.109.74.84\/plan\/index  \/\/history\u6a21\u5f0f\u8def\u7531\r\n<\/code><\/pre>\n<p>history\u6a21\u5f0f\u57fa\u4e8ewindow.history\u5bf9\u8c61\u7684\u65b9\u6cd5<\/p>\n<p>\u5728HTML4\u4e2d\uff0c\u5df2\u7ecf\u652f\u6301window.history\u5bf9\u8c61\u6765\u63a7\u5236\u9875\u9762\u5386\u53f2\u8bb0\u5f55\u8df3\u8f6c\uff0c\u5e38\u7528\u7684\u65b9\u6cd5\u5305\u62ec\uff1a<\/p>\n<pre><code class='language-js' lang='js'>   history.forward(); \/\/\u5728\u5386\u53f2\u8bb0\u5f55\u4e2d\u524d\u8fdb\u4e00\u6b65\r\n   history.back(); \/\/\u5728\u5386\u53f2\u8bb0\u5f55\u4e2d\u540e\u9000\u4e00\u6b65\r\n   history.go(n): \/\/\u5728\u5386\u53f2\u8bb0\u5f55\u4e2d\u8df3\u8f6cn\u6b65\u9aa4\uff0cn=0\u4e3a\u5237\u65b0\u672c\u9875,n=-1\u4e3a\u540e\u9000\u4e00\u9875\u3002\r\n  \r\n  \u5728HTML5\u4e2d\uff0cwindow.history\u5bf9\u8c61\u5f97\u5230\u4e86\u6269\u5c55\uff0c\u65b0\u589e\u7684API\u5305\u62ec\uff1a\r\n  \r\n   history.pushState(data[,title][,url]);\/\/\u5411\u5386\u53f2\u8bb0\u5f55\u4e2d\u8ffd\u52a0\u4e00\u6761\u8bb0\u5f55\r\n   history.replaceState(data[,title][,url]);\/\/\u66ff\u6362\u5f53\u524d\u9875\u5728\u5386\u53f2\u8bb0\u5f55\u4e2d\u7684\u4fe1\u606f\u3002\r\n   history.state;\/\/\u662f\u4e00\u4e2a\u5c5e\u6027\uff0c\u53ef\u4ee5\u5f97\u5230\u5f53\u524d\u9875\u7684state\u4fe1\u606f\u3002\r\n   window.onpopstate;\/\/\u662f\u4e00\u4e2a\u4e8b\u4ef6\uff0c\u5728\u70b9\u51fb\u6d4f\u89c8\u5668\u540e\u9000\u6309\u94ae\u6216js\u8c03\u7528forward()\u3001back()\u3001go()\u65f6\u89e6\u53d1\u3002\u76d1\u542c\u51fd\u6570\u4e2d\u53ef\u4f20\u5165\u4e00\u4e2aevent\u5bf9\u8c61\uff0cevent.state\u5373\u4e3a\u901a\u8fc7pushState()\u6216replaceState()\u65b9\u6cd5\u4f20\u5165\u7684data\u53c2\u6570\r\n<\/code><\/pre>\n<p>history\u6a21\u5f0f\u539f\u7406\u53ef\u4ee5\u8fd9\u6837\u7406\u89e3\uff0c\u9996\u5148\u6211\u4eec\u8981\u6539\u9020\u6211\u4eec\u7684\u8d85\u94fe\u63a5\uff0c\u7ed9\u6bcf\u4e2a\u8d85\u94fe\u63a5\u589e\u52a0onclick\u65b9\u6cd5\uff0c\u963b\u6b62\u9ed8\u8ba4\u7684\u8d85\u94fe\u63a5\u8df3\u8f6c\uff0c\u6539\u7528history.pushState\u6216history.replaceState\u6765\u66f4\u6539\u6d4f\u89c8\u5668\u4e2d\u7684url\uff0c\u5e76\u4fee\u6539\u9875\u9762\u5185\u5bb9\u3002\u7531\u4e8e\u901a\u8fc7history\u7684api\u8c03\u6574\uff0c\u5e76\u4e0d\u4f1a\u5411\u540e\u7aef\u53d1\u8d77\u8bf7\u6c42\uff0c\u6240\u4ee5\u4e5f\u5c31\u8fbe\u5230\u4e86\u524d\u7aef\u8def\u7531\u7684\u76ee\u7684\u3002<\/p>\n<p>\u5982\u679c\u7528\u6237\u4f7f\u7528\u6d4f\u89c8\u5668\u7684\u524d\u8fdb\u540e\u9000\u6309\u94ae\uff0c\u5219\u4f1a\u89e6\u53d1window.onpopstate\u4e8b\u4ef6\uff0c\u76d1\u542c\u9875\u9762\u6839\u636e\u8def\u7531\u5730\u5740\u4fee\u6539\u9875\u9762\u5185\u5bb9\u3002<\/p>\n<p>\u4e5f\u4e0d\u4e00\u5b9a\u975e\u8981\u7528\u8d85\u94fe\u63a5\uff0c\u4efb\u610f\u5143\u7d20\u4f5c\u4e3a\u83dc\u5355\u90fd\u884c\uff0c\u53ea\u8981\u5728\u70b9\u51fb\u4e8b\u4ef6\u4e2d\u901a\u8fc7history\u8fdb\u884c\u8c03\u6574\u5373\u53ef\u3002<\/p>\n<h4>1. \u5b9e\u73b0\u539f\u7406<\/h4>\n<pre><code class='language-js' lang='js'>\/\/\u6d4f\u89c8\u5668\u63a7\u5236\u53f0\u6267\u884c\u4e0b\u5217\u6d4b\u8bd5\u4ee3\u7801\r\nwindow.onpopstate = (e) =&gt; {   \r\n    const path = location.pathname;\r\n    console.log(&#39;path :&#39;,path);\r\n    switch (path) {\r\n        case &#39;\/index&#39;:\r\n            console.log(&#39;\u8fd9\u662f\u9996\u9875\u5185\u5bb9&#39;)\r\n            break\r\n        case &#39;\/news&#39;:\r\n            console.log(&#39;\u8fd9\u662f\u65b0\u95fb\u5185\u5bb9&#39;)\r\n            break\r\n        default:\r\n            console.log(&#39;404\u627e\u4e0d\u5230\u8d44\u6e90&#39;)\r\n    }\r\n}\r\n\/**\r\n\u4f7f\u7528\u65b9\u6cd5\r\npushState(state, title, url)\r\n\r\n\u53c2\u6570\u8bf4\u660e\r\nstate: \u53ef\u4ee5\u901a\u8fc7history.state\u8bfb\u53d6\r\ntitle: \u53ef\u9009\u53c2\u6570\uff0c\u6682\u65f6\u6ca1\u6709\u7528\uff0c\u5efa\u8bae\u4f20\u4e2a\u77ed\u6807\u9898\r\nurl: \u6539\u53d8\u8fc7\u540e\u7684url\u5730\u5740\r\n*\/\r\nhistory.pushState({page: 1}, &quot;title 1&quot;, &quot;\/index&quot;);\r\nwindow.history.pushState({page:1},&#39;&#39;,&#39;https:\/\/it.zhousir.top\/index&#39;)\r\n<\/code><\/pre>\n<h5>popstate\u4e8b\u4ef6\u8bf4\u660e<\/h5>\n<p>\u5f53\u7528\u6237\u5728\u6d4f\u89c8\u5668\u70b9\u51fb\u8fdb\u884c\u540e\u9000\u3001\u524d\u8fdb\uff0c\u6216\u8005\u5728js\u4e2d\u8c03\u7528<code>histroy.back()<\/code>\uff0c<code>history.go()<\/code>\uff0c<code>history.forward()<\/code>\u7b49\uff0c\u4f1a\u89e6\u53d1popstate\u4e8b\u4ef6\uff1b\u4f46pushState\u3001replaceState\u4e0d\u4f1a\u89e6\u53d1\u8fd9\u4e2a\u4e8b\u4ef6\u3002<\/p>\n<p> \u90a3\u4e48\u5982\u4f55\u76d1\u542c\u00a0<code>pushState<\/code>\u00a0\u548c\u00a0<code>replaceState<\/code>\u00a0\u7684\u53d8\u5316\u5462\uff1f\u5177\u4f53\u53ef\u53c2\u8003\u8be5\u6587\u00a0<a href='https:\/\/links.jianshu.com\/go?to=https%3A%2F%2Fjuejin.im%2Fpost%2F5c2708cd6fb9a049f06a5744'>\u5982\u4f55\u76d1\u542cURL\u7684\u53d8\u5316\uff1f<\/a> <\/p>\n<pre><code class='language-js' lang='js'>window.addEventListener(&#39;pushState&#39;, function(e) {\r\n  console.log(&#39;THEY DID IT AGAIN! pushState 2222222&#39;);\r\n});\r\n<\/code><\/pre>\n<\/p>\n<h4>2. history\u793a\u4f8b<\/h4>\n<p>html\uff1a<\/p>\n<pre><code class='language-html' lang='html'>&lt;ul id=&quot;menu&quot;&gt;\r\n    &lt;li&gt;\r\n        &lt;a href=&quot;\/index&quot;&gt;\u9996\u9875&lt;\/a&gt;\r\n    &lt;\/li&gt;\r\n    &lt;li&gt;\r\n        &lt;a href=&quot;\/news&quot;&gt;\u8d44\u8baf&lt;\/a&gt;\r\n    &lt;\/li&gt;\r\n    &lt;li&gt;\r\n        &lt;a href=&quot;\/user&quot;&gt;\u4e2a\u4eba\u4e2d\u5fc3&lt;\/a&gt;\r\n    &lt;\/li&gt;\r\n \r\n&lt;\/ul&gt;\r\n \r\n&lt;div id=&quot;app&quot;&gt;&lt;\/div&gt;\r\n<\/code><\/pre>\n<p>js\uff1a<\/p>\n<pre><code class='language-js' lang='js'>\/\/\u6539\u9020\u8d85\u94fe\u63a5\uff0c\u963b\u6b62\u9ed8\u8ba4\u8df3\u8f6c\uff0c\u9ed8\u8ba4\u7684\u8df3\u8f6c\u662f\u4f1a\u5237\u65b0\u9875\u9762\u7684\r\ndocument.querySelector(&#39;#menu&#39;).addEventListener(&#39;click&#39;,function (e) {\r\n \r\n    if(e.target.nodeName ===&#39;A&#39;){\r\n        e.preventDefault()\r\n \r\n        let path = e.target.getAttribute(&#39;href&#39;)  \/\/\u83b7\u53d6\u8d85\u94fe\u63a5\u7684href\uff0c\u6539\u4e3apushState\u8df3\u8f6c\uff0c\u4e0d\u5237\u65b0\u9875\u9762\r\n \r\n        window.history.pushState({},&#39;&#39;,path)  \/\/\u4fee\u6539\u6d4f\u89c8\u5668\u4e2d\u663e\u793a\u7684url\u5730\u5740\r\n        render(path)  \/\/\u6839\u636epath\uff0c\u66f4\u6539\u9875\u9762\u5185\u5bb9\r\n \r\n    }\r\n})\r\n \r\nfunction render(path) {\r\n    let app = document.getElementById(&#39;app&#39;)\r\n    switch (path) {\r\n        case &#39;\/index&#39;:\r\n            app.innerHTML = &#39;&lt;h1&gt;\u8fd9\u662f\u9996\u9875\u5185\u5bb9&lt;\/h1&gt;&#39;\r\n            break\r\n        case &#39;\/news&#39;:\r\n            app.innerHTML = &#39;&lt;h1&gt;\u8fd9\u662f\u65b0\u95fb\u5185\u5bb9&lt;\/h1&gt;&#39;\r\n            break\r\n        case &#39;\/user&#39;:\r\n            app.innerHTML = &#39;&lt;h1&gt;\u8fd9\u662f\u4e2a\u4eba\u4e2d\u5fc3\u5185\u5bb9&lt;\/h1&gt;&#39;\r\n            break\r\n        default:\r\n            app.innerHTML = &#39;&lt;h1&gt;404&lt;\/h1&gt;&#39;\r\n    }\r\n}\r\n \r\n\/\/\u76d1\u542c\u6d4f\u89c8\u5668\u524d\u8fdb\u540e\u9000\u4e8b\u4ef6\uff0c\u5e76\u6839\u636e\u5f53\u524d\u8def\u5f84\u6e32\u67d3\u9875\u9762\r\n \r\nwindow.onpopstate = function (e) {\r\n    render(location.pathname)\r\n}\r\n \r\n\/\/\u7b2c\u4e00\u6b21\u8fdb\u5165\u9875\u9762\u663e\u793a\u9996\u9875\r\nrender(&#39;\/index&#39;)\r\n<\/code><\/pre>\n<p>\u4e0a\u9762\u8fd9\u4e2a\u5199\u6cd5\u592alow\uff0c\u6211\u4eec\u53ef\u4ee5\u7528\u7c7b\u5c01\u88c5\u4e00\u4e0b\uff0c\u901a\u8fc7add\u65b9\u6cd5\u6dfb\u52a0\u8def\u7531\uff0c\u901a\u8fc7pushState\u8fdb\u884c\u8df3\u8f6c\uff0c\u521d\u59cb\u5316\u65f6\u66f4\u6539\u6240\u4ee5\u8d85\u94fe\u63a5\u7684\u8df3\u8f6c\u65b9\u5f0f<\/p>\n<p>\u5f53\u7136\uff0c\u4e0a\u9762\u8fd9\u4e2a\u5b9e\u73b0\u53ea\u662f\u4e00\u4e2a\u975e\u5e38\u521d\u7ea7\u7684demo\uff0c\u5e76\u4e0d\u80fd\u7528\u4e8e\u771f\u6b63\u7684\u5f00\u53d1\u573a\u666f\uff0c\u53ea\u662f\u52a0\u6df1\u5bf9\u524d\u7aef\u8def\u7531\u7684\u7406\u89e3\u3002<\/p>\n<h3>hash\u6a21\u5f0f\u548chistory\u6a21\u5f0f\u7684\u533a\u522b<\/h3>\n<ul>\n<li>hash\u6a21\u5f0f\u8f83\u4e11\uff0chistory\u6a21\u5f0f\u8f83\u4f18\u96c5<\/li>\n<li>pushState\u8bbe\u7f6e\u7684\u65b0URL\u53ef\u4ee5\u662f\u4e0e\u5f53\u524dURL\u540c\u6e90\u7684\u4efb\u610fURL\uff1b\u800chash\u53ea\u53ef\u4fee\u6539#\u540e\u9762\u7684\u90e8\u5206\uff0c\u6545\u53ea\u53ef\u8bbe\u7f6e\u4e0e\u5f53\u524d\u540c\u6587\u6863\u7684URL<\/li>\n<li>pushState\u8bbe\u7f6e\u7684\u65b0URL\u53ef\u4ee5\u4e0e\u5f53\u524dURL\u4e00\u6a21\u4e00\u6837\uff0c\u8fd9\u6837\u4e5f\u4f1a\u628a\u8bb0\u5f55\u6dfb\u52a0\u5230\u6808\u4e2d\uff1b\u800chash\u8bbe\u7f6e\u7684\u65b0\u503c\u5fc5\u987b\u4e0e\u539f\u6765\u4e0d\u4e00\u6837\u624d\u4f1a\u89e6\u53d1\u8bb0\u5f55\u6dfb\u52a0\u5230\u6808\u4e2d<\/li>\n<li>pushState\u901a\u8fc7stateObject\u53ef\u4ee5\u6dfb\u52a0\u4efb\u610f\u7c7b\u578b\u7684\u6570\u636e\u5230\u8bb0\u5f55\u4e2d\uff1b\u800chash\u53ea\u53ef\u6dfb\u52a0\u77ed\u5b57\u7b26\u4e32<\/li>\n<li>pushState\u53ef\u989d\u5916\u8bbe\u7f6etitle\u5c5e\u6027\u4f9b\u540e\u7eed\u4f7f\u7528<\/li>\n<li>hash\u517c\u5bb9IE8\u4ee5\u4e0a\uff0chistory\u517c\u5bb9IE10\u4ee5\u4e0a<\/li>\n<li>history\u6a21\u5f0f\u9700\u8981\u540e\u7aef\u914d\u5408\u5c06\u6240\u6709\u8bbf\u95ee\u90fd\u6307\u5411index.html\uff0c\u5426\u5219\u7528\u6237\u5237\u65b0\u9875\u9762\uff0c\u4f1a\u5bfc\u81f4404\u9519\u8bef<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>\u76ee\u524d\u5355\u9875\u5e94\u7528\uff08SPA\uff09\u8d8a\u6765\u8d8a\u6210\u4e3a\u524d\u7aef\u4e3b\u6d41\uff0c\u5355\u9875\u5e94\u7528\u4e00\u5927\u7279\u70b9\u5c31\u662f\u4f7f\u7528\u524d\u7aef\u8def\u7531\uff0c\u7531\u524d\u7aef\u6765\u76f4\u63a5\u63a7\u5236\u8def\u7531\u8df3\u8f6c\u903b\u8f91\uff0c\u800c\u4e0d [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[109,105],"tags":[117],"_links":{"self":[{"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=\/wp\/v2\/posts\/2514"}],"collection":[{"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2514"}],"version-history":[{"count":4,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=\/wp\/v2\/posts\/2514\/revisions"}],"predecessor-version":[{"id":2518,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=\/wp\/v2\/posts\/2514\/revisions\/2518"}],"wp:attachment":[{"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2514"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2514"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2514"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}