{"id":84,"date":"2022-05-29T14:59:26","date_gmt":"2022-05-29T06:59:26","guid":{"rendered":"http:\/\/www.33weixin.com\/index\/?p=84"},"modified":"2022-05-29T15:00:08","modified_gmt":"2022-05-29T07:00:08","slug":"%e6%9c%8d%e5%8a%a1%e7%ab%af%e6%b8%b2%e6%9f%93","status":"publish","type":"post","link":"http:\/\/www.33weixin.com\/index\/index.php\/2022\/05\/29\/%e6%9c%8d%e5%8a%a1%e7%ab%af%e6%b8%b2%e6%9f%93\/","title":{"rendered":"\u670d\u52a1\u7aef\u6e32\u67d3"},"content":{"rendered":"<h2 id=\"\u9700\u8981\u670d\u52a1\u7aef\u6e32\u67d3\uff08ssr\uff09\u5417\uff1f\">\u9700\u8981\u670d\u52a1\u7aef\u6e32\u67d3\uff08SSR\uff09\u5417\uff1f<\/h2>\n<p>\u5728\u5f00\u59cb\u670d\u52a1\u7aef\u6e32\u67d3\u524d\uff0c\u6211\u4eec\u5148\u770b\u770b\u5b83\u80fd\u7ed9\u6211\u4eec\u5e26\u6765\u4ec0\u4e48\uff0c\u4ee5\u53ca\u4ec0\u4e48\u65f6\u5019\u9700\u8981\u7528\u5b83\u3002<\/p>\n<h3 id=\"seo\uff08\u641c\u7d22\u5f15\u64ce\u4f18\u5316\uff09\">SEO\uff08\u641c\u7d22\u5f15\u64ce\u4f18\u5316\uff09<\/h3>\n<p>\u8c37\u6b4c\u548cBing\u53ef\u4ee5\u5f88\u597d\u5730\u7d22\u5f15\u540c\u6b65\u7684JavaScript\u5e94\u7528\u3002<em>\u540c\u6b65<\/em>\u5728\u8fd9\u91cc\u662f\u4e2a\u5173\u952e\u8bcd\u3002\u5982\u679c\u5e94\u7528\u542f\u52a8\u65f6\u6709\u4e00\u4e2a\u52a0\u8f7d\u52a8\u753b\uff0c\u7136\u540e\u5185\u5bb9\u901a\u8fc7ajax\u83b7\u53d6\uff0c\u90a3\u722c\u866b\u4e0d\u4f1a\u7b49\u5f85\u4ed6\u4eec\u52a0\u8f7d\u5b8c\u6210\u3002<\/p>\n<p>\u8fd9\u610f\u5473\u7740\u5728\u5f02\u6b65\u83b7\u53d6\u5185\u5bb9\u7684\u9875\u9762\u4e0a\u5f88\u9700\u8981\u8fdb\u884c\u641c\u7d22\u5f15\u64ce\u4f18\u5316\u7684\u65f6\u5019\uff0c\u670d\u52a1\u7aef\u6e32\u67d3\u5c31\u5f88\u91cd\u8981\u3002<\/p>\n<h3 id=\"\u5ba2\u6237\u7aef\u7684\u7f51\u7edc\u6bd4\u8f83\u6162\">\u5ba2\u6237\u7aef\u7684\u7f51\u7edc\u6bd4\u8f83\u6162<\/h3>\n<p>\u7528\u6237\u53ef\u80fd\u5728\u7f51\u7edc\u6bd4\u8f83\u6162\u7684\u60c5\u51b5\u4e0b\u4ece\u8fdc\u5904\u8bbf\u95ee\u7f51\u7ad9 &#8211; \u6216\u8005\u901a\u8fc7\u6bd4\u8f83\u5dee\u7684\u5e26\u5bbd\u3002 \u8fd9\u4e9b\u60c5\u51b5\u4e0b\uff0c\u5c3d\u91cf\u51cf\u5c11\u9875\u9762\u8bf7\u6c42\u6570\u91cf\uff0c\u6765\u4fdd\u8bc1\u7528\u6237\u5c3d\u5feb\u770b\u5230\u57fa\u672c\u7684\u5185\u5bb9\u3002<\/p>\n<p>\u53ef\u4ee5\u7528\u00a0<a href=\"https:\/\/webpack.github.io\/docs\/code-splitting.html\" target=\"_blank\" rel=\"noopener\">Webpack\u7684\u4ee3\u7801\u62c6\u5206<\/a>\u00a0\u907f\u514d\u5f3a\u5236\u7528\u6237\u4e0b\u8f7d\u6574\u4e2a\u5355\u9875\u9762\u5e94\u7528\uff0c\u4f46\u662f\uff0c\u8fd9\u6837\u4e5f\u8fdc\u6ca1\u6709\u4e0b\u8f7d\u4e2a\u5355\u72ec\u7684\u9884\u5148\u6e32\u67d3\u8fc7\u7684HTML\u6587\u4ef6\u6027\u80fd\u9ad8\u3002<\/p>\n<h3 id=\"\u5ba2\u6237\u7aef\u8fd0\u884c\u5728\u8001\u7684\u6216\u8005\u76f4\u63a5\u6ca1\u6709javascript\u5f15\u64ce\u4e0a\">\u5ba2\u6237\u7aef\u8fd0\u884c\u5728\u8001\u7684(\u6216\u8005\u76f4\u63a5\u6ca1\u6709)JavaScript\u5f15\u64ce\u4e0a<\/h3>\n<p>\u5bf9\u4e8e\u4e16\u754c\u4e0a\u7684\u4e00\u4e9b\u5730\u533a\u4eba\uff0c\u53ef\u80fd\u53ea\u80fd\u75281998\u5e74\u4ea7\u7684\u7535\u8111\u8bbf\u95ee\u4e92\u8054\u7f51\u7684\u65b9\u5f0f\u4f7f\u7528\u8ba1\u7b97\u673a\u3002\u800cVue\u53ea\u80fd\u8fd0\u884c\u5728IE9\u4ee5\u4e0a\u7684\u6d4f\u89c8\u5668\uff0c\u4f60\u53ef\u4ee5\u4e5f\u60f3\u4e3a\u90a3\u4e9b\u8001\u5f0f\u6d4f\u89c8\u5668\u63d0\u4f9b\u57fa\u7840\u5185\u5bb9 &#8211; \u6216\u8005\u662f\u5728\u547d\u4ee4\u884c\u4e2d\u4f7f\u7528\u00a0<a href=\"http:\/\/lynx.browser.org\/\" target=\"_blank\" rel=\"noopener\">Lynx<\/a>\u7684\u65f6\u9ae6\u7684\u9ed1\u5ba2\u3002<\/p>\n<h3 id=\"\u670d\u52a1\u7aef\u6e32\u67d3-\u5bf9\u6bd4-\u9884\u6e32\u67d3prerendering\">\u670d\u52a1\u7aef\u6e32\u67d3 \u5bf9\u6bd4 \u9884\u6e32\u67d3(Prerendering)<\/h3>\n<p>\u5982\u679c\u4f60\u53ea\u662f\u7528\u670d\u52a1\u7aef\u6e32\u67d3\u6765\u6539\u5584\u4e00\u4e2a\u5c11\u6570\u7684\u8425\u9500\u9875\u9762\uff08\u5982 \u9996\u9875\uff0c\u5173\u4e8e\uff0c\u8054\u7cfb \u7b49\u7b49\uff09\u7684SEO\uff0c\u90a3\u4f60\u53ef\u4ee5\u7528<strong>\u9884\u6e32\u67d3<\/strong>\u66ff\u6362\u3002\u9884\u6e32\u67d3\u4e0d\u50cf\u670d\u52a1\u5668\u6e32\u67d3\u90a3\u6837\u5373\u65f6\u7f16\u8bd1HTML,\u9884\u6e32\u67d3\u53ea\u662f\u5728\u6784\u5efa\u65f6\u4e3a\u4e86\u7279\u5b9a\u7684\u8def\u7531\u751f\u6210\u7279\u5b9a\u7684\u51e0\u4e2a\u9759\u6001\u9875\u9762\u3002\u5176\u4f18\u52bf\u662f\u9884\u6e32\u67d3\u7684\u8bbe\u7f6e\u66f4\u52a0\u7b80\u5355\uff0c\u53ef\u4ee5\u4fdd\u6301\u524d\u7aef\u662f\u4e00\u4e2a\u5b8c\u6574\u7684\u9759\u6001\u7ad9\u3002<\/p>\n<p>\u4f60\u7528webpack\u53ef\u4ee5\u5f88\u7b80\u5355\u5730\u901a\u8fc7<a href=\"https:\/\/github.com\/chrisvfritz\/prerender-spa-plugin\" target=\"_blank\" rel=\"noopener\">prerender-spa-plugin<\/a>\u6765\u6dfb\u52a0\u9884\u6e32\u67d3\uff0c\u5b83\u88ab\u5e7f\u6cdb\u5730\u7528\u5728Vue\u5e94\u7528\u4e0a &#8211; \u4e8b\u5b9e\u4e0a\uff0c\u521b\u5efa\u8005\u4e5f\u662fVue\u6838\u5fc3\u56e2\u961f\u6210\u5458\u4e4b\u4e00\u3002<\/p>\n<h2 id=\"hello-world\">Hello World<\/h2>\n<p>\u51c6\u5907\u5728\u884c\u52a8\u4e2d\u4f53\u9a8c\u670d\u52a1\u7aef\u6e32\u67d3\u5427\u3002\u670d\u52a1\u7aef\u6e32\u67d3(\u5373SSR)\u542c\u8d77\u6765\u5f88\u590d\u6742\uff0c\u4e0d\u8fc7\u4e00\u4e2a\u7b80\u5355\u7684Node\u811a\u672c\u53ea\u9700\u89813\u6b65\u5c31\u53ef\u4ee5\u5b9e\u73b0\u8fd9\u4e2a\u529f\u80fd:<\/p>\n<pre><code class=\"lang-js\"><span class=\"hljs-comment\">\/\/ \u6b65\u9aa4 1:\u521b\u5efa\u4e00\u4e2aVue\u5b9e\u4f8b<\/span>\n<span class=\"hljs-keyword\">var<\/span> Vue = <span class=\"hljs-built_in\">require<\/span>(<span class=\"hljs-string\">'vue'<\/span>)\n<span class=\"hljs-keyword\">var<\/span> app = <span class=\"hljs-keyword\">new<\/span> Vue({\n  render: <span class=\"hljs-function\"><span class=\"hljs-keyword\">function<\/span> (<span class=\"hljs-params\">h<\/span>) <\/span>{\n    <span class=\"hljs-keyword\">return<\/span> h(<span class=\"hljs-string\">'p'<\/span>, <span class=\"hljs-string\">'hello world'<\/span>)\n  }\n})\n\n<span class=\"hljs-comment\">\/\/ \u6b65\u9aa4 2: \u521b\u5efa\u4e00\u4e2a\u6e32\u67d3\u5668<\/span>\n<span class=\"hljs-keyword\">var<\/span> renderer = <span class=\"hljs-built_in\">require<\/span>(<span class=\"hljs-string\">'vue-server-renderer'<\/span>).createRenderer()\n\n<span class=\"hljs-comment\">\/\/ \u6b65\u9aa4 3: \u5c06 Vue\u5b9e\u4f8b \u6e32\u67d3\u6210 HTML<\/span>\n\nrenderer.renderToString(app, <span class=\"hljs-function\"><span class=\"hljs-keyword\">function<\/span> (<span class=\"hljs-params\">error, html<\/span>) <\/span>{\n  <span class=\"hljs-keyword\">if<\/span> (error) <span class=\"hljs-keyword\">throw<\/span> error\n  <span class=\"hljs-built_in\">console<\/span>.log(html)\n  <span class=\"hljs-comment\">\/\/ =&gt; &lt;p server-rendered=\"true\"&gt;hello world&lt;\/p&gt;<\/span>\n})\n<\/code><\/pre>\n<p>\u8fd9\u5e76\u4e0d\u56f0\u96be\u3002\u5f53\u7136\u8fd9\u4e2a\u793a\u4f8b\u6bd4\u5927\u90e8\u5206\u5e94\u7528\u90fd\u7b80\u5355\u3002\u6211\u4eec\u4e0d\u5fc5\u62c5\u5fc3\uff1a<\/p>\n<ul>\n<li>\u4e00\u4e2aWeb\u670d\u52a1\u5668<\/li>\n<li>\u6d41\u5f0f\u54cd\u5e94<\/li>\n<li>\u7ec4\u4ef6\u7f13\u5b58<\/li>\n<li>\u6784\u5efa\u8fc7\u7a0b<\/li>\n<li>\u8def\u7531<\/li>\n<li>Vuex\u72b6\u6001\u7ba1\u7406<\/li>\n<\/ul>\n<p>\u8fd9\u4e2a\u6307\u5357\u7684\u5176\u4f59\u90e8\u5206\uff0c\u6211\u4eec\u5c06\u63a2\u8ba8\u8fd9\u4e9b\u529f\u80fd\u600e\u6837\u8fd0\u4f5c\u3002\u4e00\u65e6\u4f60\u7406\u89e3\u4e86\u57fa\u7840\uff0c\u6211\u4eec\u4f1a\u63d0\u4f9b\u66f4\u591a\u7ec6\u8282\u548c\u8fdb\u4e00\u6b65\u7684\u793a\u4f8b\u6765\u5e2e\u52a9\u4f60\u89e3\u51b3\u610f\u5916\u60c5\u51b5\u3002<\/p>\n<h2 id=\"\u901a\u8fc7express-web\u670d\u52a1\u5668\u5b9e\u73b0\u7b80\u5355\u7684\u670d\u52a1\u7aef\u6e32\u67d3\">\u901a\u8fc7Express Web\u670d\u52a1\u5668\u5b9e\u73b0\u7b80\u5355\u7684\u670d\u52a1\u7aef\u6e32\u67d3<\/h2>\n<p>\u5982\u679c\u6ca1\u6709\u4e00\u4e2aWeb\u670d\u52a1\u5668\uff0c\u5f88\u96be\u8bf4\u662f\u670d\u52a1\u7aef\u6e32\u67d3\uff0c\u6240\u4ee5\u6211\u4eec\u6765\u8865\u5145\u5b83\u3002\u6211\u4eec\u5c06\u6784\u5efa\u4e00\u4e2a\u975e\u5e38\u7b80\u5355\u7684\u670d\u52a1\u7aef\u6e32\u67d3\u5e94\u7528\uff0c\u53ea\u7528ES5\uff0c\u4e5f\u4e0d\u5e26\u5176\u4ed6\u6784\u5efa\u6b65\u9aa4\u6216Vue\u63d2\u4ef6\u3002<\/p>\n<p>\u542f\u52a8\u4e00\u4e2a\u5e94\u7528\u544a\u8bc9\u7528\u6237\u4ed6\u4eec\u5728\u4e00\u4e2a\u9875\u9762\u4e0a\u82b1\u4e86\u591a\u5c11\u65f6\u95f4\u3002<\/p>\n<pre><code class=\"lang-js\"><span class=\"hljs-keyword\">new<\/span> Vue({\n  template: <span class=\"hljs-string\">'&lt;div&gt;\u4f60\u5df2\u7ecf\u5728\u8fd9\u82b1\u4e86 {{ counter }} \u79d2\u3002&lt;\/div&gt;'<\/span>,\n  data: {\n    counter: <span class=\"hljs-number\">0<\/span>\n  },\n  created: <span class=\"hljs-function\"><span class=\"hljs-keyword\">function<\/span> () <\/span>{\n    <span class=\"hljs-keyword\">var<\/span> vm = <span class=\"hljs-keyword\">this<\/span>\n    setInterval(<span class=\"hljs-function\"><span class=\"hljs-keyword\">function<\/span> () <\/span>{\n      vm.counter += <span class=\"hljs-number\">1<\/span>\n    }, <span class=\"hljs-number\">1000<\/span>)\n  }\n})\n<\/code><\/pre>\n<p>\u4e3a\u4e86\u9002\u5e94\u670d\u52a1\u7aef\u6e32\u67d3\uff0c\u6211\u4eec\u9700\u8981\u8fdb\u884c\u4e00\u4e9b\u4fee\u6539\uff0c\u8ba9\u5b83\u53ef\u4ee5\u5728\u6d4f\u89c8\u5668\u548cNode\u4e2d\u6e32\u67d3\uff1a<\/p>\n<ul>\n<li>\u5728\u6d4f\u89c8\u5668\u4e2d\uff0c\u5c06\u6211\u4eec\u7684\u5e94\u7528\u5b9e\u4f8b\u6dfb\u52a0\u5230\u5168\u5c40\u4e0a\u4e0b\u6587\uff08\u00a0<code>window<\/code>\uff09\u4e0a,\u6211\u4eec\u53ef\u4ee5\u5b89\u88c5\u5b83\u3002<\/li>\n<li>\u5728Node\u4e2d\uff0c\u5bfc\u51fa\u4e00\u4e2a\u5de5\u5382\u51fd\u6570\u8ba9\u6211\u4eec\u53ef\u4ee5\u4e3a\u6bcf\u4e2a\u8bf7\u6c42\u521b\u5efa\u5e94\u7528\u5b9e\u4f8b\u3002<\/li>\n<\/ul>\n<p>\u5b9e\u73b0\u8fd9\u4e2a\u9700\u8981\u4e00\u70b9\u6a21\u677f\uff1a<\/p>\n<pre><code class=\"lang-js\"><span class=\"hljs-comment\">\/\/ assets\/app.js<\/span>\n(<span class=\"hljs-function\"><span class=\"hljs-keyword\">function<\/span> () <\/span>{ <span class=\"hljs-string\">'use strict'<\/span>\n  <span class=\"hljs-keyword\">var<\/span> createApp = <span class=\"hljs-function\"><span class=\"hljs-keyword\">function<\/span> () <\/span>{\n    <span class=\"hljs-comment\">\/\/ ---------------------<\/span>\n    <span class=\"hljs-comment\">\/\/ \u5f00\u59cb\u5e38\u7528\u7684\u5e94\u7528\u4ee3\u7801<\/span>\n    <span class=\"hljs-comment\">\/\/ ---------------------<\/span>\n\n    <span class=\"hljs-comment\">\/\/ \u4e3b\u8981\u7684Vue\u5b9e\u4f8b\u5fc5\u987b\u8fd4\u56de\uff0c\u5e76\u4e14\u6709\u4e00\u4e2a\u6839\u8282\u70b9\u5728id \"app\"\u4e0a\uff0c\u8fd9\u6837\u5ba2\u6237\u7aef\u53ef\u4ee5\u52a0\u8f7d\u5b83\u3002<\/span>\n\n    <span class=\"hljs-keyword\">return<\/span> <span class=\"hljs-keyword\">new<\/span> Vue({\n      template: <span class=\"hljs-string\">'&lt;div id=\"app\"&gt;\u4f60\u5df2\u7ecf\u5728\u8fd9\u82b1\u4e86 {{ counter }} \u79d2\u3002&lt;\/div&gt;'<\/span>,\n      data: {\n        counter: <span class=\"hljs-number\">0<\/span>\n      },\n      created: <span class=\"hljs-function\"><span class=\"hljs-keyword\">function<\/span> () <\/span>{\n        <span class=\"hljs-keyword\">var<\/span> vm = <span class=\"hljs-keyword\">this<\/span>\n        setInterval(<span class=\"hljs-function\"><span class=\"hljs-keyword\">function<\/span> () <\/span>{\n          vm.counter += <span class=\"hljs-number\">1<\/span>\n        }, <span class=\"hljs-number\">1000<\/span>)\n      }\n    })\n\n    <span class=\"hljs-comment\">\/\/ -------------------<\/span>\n    <span class=\"hljs-comment\">\/\/ \u7ed3\u675f\u5e38\u7528\u7684\u5e94\u7528\u4ee3\u7801<\/span>\n    <span class=\"hljs-comment\">\/\/ -------------------<\/span>\n  }\n  <span class=\"hljs-keyword\">if<\/span> (<span class=\"hljs-keyword\">typeof<\/span> <span class=\"hljs-built_in\">module<\/span> !== <span class=\"hljs-string\">'undefined'<\/span> &amp;&amp; <span class=\"hljs-built_in\">module<\/span>.exports) {\n    <span class=\"hljs-built_in\">module<\/span>.exports = createApp\n  } <span class=\"hljs-keyword\">else<\/span> {\n    <span class=\"hljs-keyword\">this<\/span>.app = createApp()\n  }\n}).call(<span class=\"hljs-keyword\">this<\/span>)\n<\/code><\/pre>\n<p>\u73b0\u5728\u6709\u4e86\u5e94\u7528\u4ee3\u7801\uff0c\u63a5\u7740\u52a0\u4e00\u4e2a html\u6587\u4ef6\u3002<\/p>\n<pre><code class=\"lang-html\"><span class=\"hljs-comment\">&lt;!-- index.html --&gt;<\/span>\n<span class=\"hljs-meta\">&lt;!DOCTYPE html&gt;<\/span>\n<span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">html<\/span>&gt;<\/span>\n<span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">head<\/span>&gt;<\/span>\n  <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">title<\/span>&gt;<\/span>My Vue App<span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">title<\/span>&gt;<\/span>\n  <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">script<\/span> <span class=\"hljs-attr\">src<\/span>=<span class=\"hljs-string\">\"\/assets\/vue.js\"<\/span>&gt;<\/span><span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">script<\/span>&gt;<\/span>\n<span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">head<\/span>&gt;<\/span>\n<span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">body<\/span>&gt;<\/span>\n  <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">div<\/span> <span class=\"hljs-attr\">id<\/span>=<span class=\"hljs-string\">\"app\"<\/span>&gt;<\/span><span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">div<\/span>&gt;<\/span>\n  <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">script<\/span> <span class=\"hljs-attr\">src<\/span>=<span class=\"hljs-string\">\"\/assets\/app.js\"<\/span>&gt;<\/span><span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">script<\/span>&gt;<\/span>\n  <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">script<\/span>&gt;<\/span><span class=\"actionscript\">app.$mount(<span class=\"hljs-string\">'#app'<\/span>)<\/span><span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">script<\/span>&gt;<\/span>\n<span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">body<\/span>&gt;<\/span>\n<span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">html<\/span>&gt;<\/span>\n<\/code><\/pre>\n<p>\u4e3b\u8981\u5f15\u7528<code>assets<\/code>\u6587\u4ef6\u5939\u4e2d\u6211\u4eec\u5148\u524d\u521b\u5efa\u7684<code>app.js<\/code>\uff0c\u4ee5\u53ca<code>vue.js<\/code>\u6587\u4ef6\uff0c\u6211\u4eec\u5c31\u6709\u4e86\u4e00\u4e2a\u53ef\u4ee5\u8fd0\u884c\u7684\u5355\u9875\u9762\u5e94\u7528<\/p>\n<p>\u7136\u540e\u4e3a\u4e86\u5b9e\u73b0\u670d\u52a1\u7aef\u6e32\u67d3\uff0c\u5728\u670d\u52a1\u7aef\u9700\u8981\u52a0\u4e00\u4e2a\u6b65\u9aa4\u3002<\/p>\n<pre><code class=\"lang-js\"><span class=\"hljs-comment\">\/\/ server.js<\/span>\n<span class=\"hljs-meta\">'use strict'<\/span>\n\n<span class=\"hljs-keyword\">var<\/span> fs = <span class=\"hljs-built_in\">require<\/span>(<span class=\"hljs-string\">'fs'<\/span>)\n<span class=\"hljs-keyword\">var<\/span> path = <span class=\"hljs-built_in\">require<\/span>(<span class=\"hljs-string\">'path'<\/span>)\n\n<span class=\"hljs-comment\">\/\/ \u5b9a\u4e49\u5168\u5c40\u7684Vue\u4e3a\u4e86\u670d\u52a1\u7aef\u7684app.js<\/span>\nglobal.Vue = <span class=\"hljs-built_in\">require<\/span>(<span class=\"hljs-string\">'vue'<\/span>)\n\n<span class=\"hljs-comment\">\/\/ \u83b7\u53d6HTML\u5e03\u5c40<\/span>\n<span class=\"hljs-keyword\">var<\/span> layout = fs.readFileSync(<span class=\"hljs-string\">'.\/index.html'<\/span>, <span class=\"hljs-string\">'utf8'<\/span>)\n\n<span class=\"hljs-comment\">\/\/ \u521b\u5efa\u4e00\u4e2a\u6e32\u67d3\u5668<\/span>\n<span class=\"hljs-keyword\">var<\/span> renderer = <span class=\"hljs-built_in\">require<\/span>(<span class=\"hljs-string\">'vue-server-renderer'<\/span>).createRenderer()\n\n<span class=\"hljs-comment\">\/\/ \u521b\u5efa\u4e00\u4e2aExpress\u670d\u52a1\u5668<\/span>\n<span class=\"hljs-keyword\">var<\/span> express = <span class=\"hljs-built_in\">require<\/span>(<span class=\"hljs-string\">'express'<\/span>)\n<span class=\"hljs-keyword\">var<\/span> server = express()\n\n<span class=\"hljs-comment\">\/\/ \u90e8\u7f72\u9759\u6001\u6587\u4ef6\u5939\u4e3a \"assets\"\u6587\u4ef6\u5939<\/span>\nserver.use(<span class=\"hljs-string\">'\/assets'<\/span>, express.static(\n  path.resolve(__dirname, <span class=\"hljs-string\">'assets'<\/span>)\n))\n\n<span class=\"hljs-comment\">\/\/ \u5904\u7406\u6240\u6709\u7684Get\u8bf7\u6c42<\/span>\nserver.get(<span class=\"hljs-string\">'*'<\/span>, <span class=\"hljs-function\"><span class=\"hljs-keyword\">function<\/span> (<span class=\"hljs-params\">request, response<\/span>) <\/span>{\n  <span class=\"hljs-comment\">\/\/ \u6e32\u67d3\u6211\u4eec\u7684Vue\u5e94\u7528\u4e3a\u4e00\u4e2a\u5b57\u7b26\u4e32<\/span>\n  renderer.renderToString(\n    <span class=\"hljs-comment\">\/\/ \u521b\u5efa\u4e00\u4e2a\u5e94\u7528\u5b9e\u4f8b<\/span>\n    <span class=\"hljs-built_in\">require<\/span>(<span class=\"hljs-string\">'.\/assets\/app'<\/span>)(),\n    <span class=\"hljs-comment\">\/\/ \u5904\u7406\u6e32\u67d3\u7ed3\u679c<\/span>\n    <span class=\"hljs-function\"><span class=\"hljs-keyword\">function<\/span> (<span class=\"hljs-params\">error, html<\/span>) <\/span>{\n      <span class=\"hljs-comment\">\/\/ \u5982\u679c\u6e32\u67d3\u65f6\u53d1\u751f\u4e86\u9519\u8bef<\/span>\n      <span class=\"hljs-keyword\">if<\/span> (error) {\n        <span class=\"hljs-comment\">\/\/ \u6253\u5370\u9519\u8bef\u5230\u63a7\u5236\u53f0<\/span>\n        <span class=\"hljs-built_in\">console<\/span>.error(error)\n        <span class=\"hljs-comment\">\/\/ \u544a\u8bc9\u5ba2\u6237\u7aef\u9519\u8bef<\/span>\n        <span class=\"hljs-keyword\">return<\/span> response\n          .status(<span class=\"hljs-number\">500<\/span>)\n          .send(<span class=\"hljs-string\">'Server Error'<\/span>)\n      }\n      <span class=\"hljs-comment\">\/\/ \u53d1\u9001\u5e03\u5c40\u548cHTML\u6587\u4ef6<\/span>\n      response.send(layout.replace(<span class=\"hljs-string\">'&lt;div id=\"app\"&gt;&lt;\/div&gt;'<\/span>, html))\n    }\n  )\n})\n\n<span class=\"hljs-comment\">\/\/ \u76d1\u542c5000\u7aef\u53e3<\/span>\nserver.listen(<span class=\"hljs-number\">5000<\/span>, <span class=\"hljs-function\"><span class=\"hljs-keyword\">function<\/span> (<span class=\"hljs-params\">error<\/span>) <\/span>{\n  <span class=\"hljs-keyword\">if<\/span> (error) <span class=\"hljs-keyword\">throw<\/span> error\n  <span class=\"hljs-built_in\">console<\/span>.log(<span class=\"hljs-string\">'Server is running at localhost:5000'<\/span>)\n})\n<\/code><\/pre>\n<p>\u8fd9\u6837\u5c31\u5b8c\u6210\u4e86\u3002<a href=\"https:\/\/github.com\/chrisvfritz\/vue-ssr-demo-simple\" target=\"_blank\" rel=\"noopener\">\u6574\u4e2a\u793a\u4f8b<\/a>\uff0c\u514b\u9686\u4e0b\u6765\u6df1\u5ea6\u5b9e\u9a8c\u3002\u4e00\u65e6\u5b83\u5728\u672c\u5730\u8fd0\u884c\u65f6\uff0c\u4f60\u53ef\u4ee5\u901a\u8fc7\u5728\u9875\u9762\u53f3\u51fb\u9009\u62e9<code>\u9875\u9762\u8d44\u6e90<\/code>\uff08\u6216\u7c7b\u4f3c\u64cd\u4f5c\uff09\u786e\u8ba4\u670d\u52a1\u9009\u6e32\u67d3\u771f\u7684\u8fd0\u884c\u4e86\u3002\u53ef\u4ee5\u5728body\u4e2d\u770b\u5230\uff1a<\/p>\n<pre><code class=\"lang-html\"><span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">div<\/span> <span class=\"hljs-attr\">id<\/span>=<span class=\"hljs-string\">\"app\"<\/span> <span class=\"hljs-attr\">server-rendered<\/span>=<span class=\"hljs-string\">\"true\"<\/span>&gt;<\/span>You have been here for 0 seconds&amp;period;<span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">div<\/span>&gt;<\/span>\n<\/code><\/pre>\n<p>\u4ee3\u66ff:<\/p>\n<pre><code class=\"lang-html\"><span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">div<\/span> <span class=\"hljs-attr\">id<\/span>=<span class=\"hljs-string\">\"app\"<\/span>&gt;<\/span><span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">div<\/span>&gt;<\/span>\n<\/code><\/pre>\n<h2 id=\"\u6d41\u5f0f\u54cd\u5e94\">\u6d41\u5f0f\u54cd\u5e94<\/h2>\n<p>Vue\u8fd8\u652f\u6301<strong>\u6d41\u5f0f<\/strong>\u6e32\u67d3\uff0c\u4f18\u5148\u9009\u62e9\u9002\u7528\u4e8e\u652f\u6301\u6d41\u7684Web\u670d\u52a1\u5668\u3002\u5141\u8bb8HTML\u4e00\u8fb9\u751f\u6210\u4e00\u822c\u5199\u5165\u76f8\u5e94\u6d41\uff0c\u800c\u4e0d\u662f\u5728\u6700\u540e\u4e00\u6b21\u5168\u90e8\u5199\u5165\u3002\u5176\u7ed3\u679c\u662f\u8bf7\u6c42\u670d\u52a1\u901f\u5ea6\u66f4\u5feb\uff0c\u6ca1\u6709\u7f3a\u70b9\uff01<\/p>\n<p>\u4e3a\u4e86\u4f7f\u4e0a\u4e00\u8282\u5e94\u7528\u4ee3\u7801\u9002\u7528\u6d41\u5f0f\u6e32\u67d3\uff0c\u53ef\u4ee5\u7b80\u5355\u7684\u66ff\u6362\u00a0<code>server.get('*',...)<\/code>\u4e3a\u4e0b\u9762\u7684\u4ee3\u7801\uff1a<\/p>\n<pre><code class=\"lang-js\"><span class=\"hljs-comment\">\/\/ \u62c6\u5206\u5e03\u5c40\u6210\u4e24\u6bb5HTML<\/span>\n<span class=\"hljs-keyword\">var<\/span> layoutSections = layout.split(<span class=\"hljs-string\">'&lt;div id=\"app\"&gt;&lt;\/div&gt;'<\/span>)\n<span class=\"hljs-keyword\">var<\/span> preAppHTML = layoutSections[<span class=\"hljs-number\">0<\/span>]\n<span class=\"hljs-keyword\">var<\/span> postAppHTML = layoutSections[<span class=\"hljs-number\">1<\/span>]\n\n<span class=\"hljs-comment\">\/\/ \u5904\u7406\u6240\u6709\u7684Get\u8bf7\u6c42<\/span>\nserver.get(<span class=\"hljs-string\">'*'<\/span>, <span class=\"hljs-function\"><span class=\"hljs-keyword\">function<\/span> (<span class=\"hljs-params\">request, response<\/span>) <\/span>{\n  <span class=\"hljs-comment\">\/\/ \u6e32\u67d3\u6211\u4eec\u7684Vue\u5b9e\u4f8b\u4f5c\u4e3a\u6d41<\/span>\n  <span class=\"hljs-keyword\">var<\/span> stream = renderer.renderToStream(<span class=\"hljs-built_in\">require<\/span>(<span class=\"hljs-string\">'.\/assets\/app'<\/span>)())\n\n  <span class=\"hljs-comment\">\/\/ \u5c06\u9884\u5148\u7684HTML\u5199\u5165\u54cd\u5e94<\/span>\n  response.write(preAppHTML)\n\n  <span class=\"hljs-comment\">\/\/ \u6bcf\u5f53\u65b0\u7684\u5757\u88ab\u6e32\u67d3<\/span>\n  stream.on(<span class=\"hljs-string\">'data'<\/span>, <span class=\"hljs-function\"><span class=\"hljs-keyword\">function<\/span> (<span class=\"hljs-params\">chunk<\/span>) <\/span>{\n    <span class=\"hljs-comment\">\/\/ \u5c06\u5757\u5199\u5165\u54cd\u5e94<\/span>\n    response.write(chunk)\n  })\n\n  <span class=\"hljs-comment\">\/\/ \u5f53\u6240\u6709\u7684\u5757\u88ab\u6e32\u67d3\u5b8c\u6210<\/span>\n  stream.on(<span class=\"hljs-string\">'end'<\/span>, <span class=\"hljs-function\"><span class=\"hljs-keyword\">function<\/span> () <\/span>{\n    <span class=\"hljs-comment\">\/\/ \u5c06post-app HTML\u5199\u5165\u54cd\u5e94<\/span>\n    response.end(postAppHTML)\n  })\n\n  <span class=\"hljs-comment\">\/\/ \u5f53\u6e32\u67d3\u65f6\u53d1\u751f\u9519\u8bef<\/span>\n  stream.on(<span class=\"hljs-string\">'error'<\/span>, <span class=\"hljs-function\"><span class=\"hljs-keyword\">function<\/span> (<span class=\"hljs-params\">error<\/span>) <\/span>{\n    <span class=\"hljs-comment\">\/\/ \u6253\u5370\u9519\u8bef\u5230\u63a7\u5236\u53f0<\/span>\n    <span class=\"hljs-built_in\">console<\/span>.error(error)\n    <span class=\"hljs-comment\">\/\/ \u544a\u8bc9\u5ba2\u670d\u7aef\u53d1\u751f\u4e86\u9519\u8bef<\/span>\n    <span class=\"hljs-keyword\">return<\/span> response\n      .status(<span class=\"hljs-number\">500<\/span>)\n      .send(<span class=\"hljs-string\">'Server Error'<\/span>)\n  })\n})\n<\/code><\/pre>\n<p>\u8fd9\u4e0d\u6bd4\u4e4b\u524d\u7684\u7248\u672c\u590d\u6742\uff0c\u751a\u81f3\u8fd9\u5bf9\u4f60\u6765\u8bf4\u90fd\u4e0d\u662f\u4e2a\u65b0\u6982\u5ff5\u3002\u6211\u4eec\u505a\u4e86\uff1a<\/p>\n<ol>\n<li>\u5efa\u7acb\u6d41<\/li>\n<li>\u5728\u5e94\u7528\u54cd\u5e94\u524d\u5199\u5165HTML<\/li>\n<li>\u5728\u53ef\u83b7\u5f97\u65f6\u5c06\u5e94\u7528HTML\u5199\u5165\u54cd\u5e94<\/li>\n<li>\u5728\u54cd\u5e94\u6700\u540e\u5199\u5165HTML<\/li>\n<li>\u5904\u7406\u4efb\u4f55\u9519\u8bef<\/li>\n<\/ol>\n<h2 id=\"\u7ec4\u4ef6\u7f13\u5b58\">\u7ec4\u4ef6\u7f13\u5b58<\/h2>\n<p>Vue\u7684\u670d\u52a1\u7aef\u6e32\u67d3\u9ed8\u8ba4\u975e\u5e38\u5feb\uff0c\u4f46\u662f\u4f60\u53ef\u4ee5\u901a\u8fc7\u7f13\u5b58\u6e32\u67d3\u597d\u7684\u7ec4\u4ef6\u8fdb\u4e00\u6b65\u63d0\u9ad8\u6027\u80fd\u3002\u8fd9\u88ab\u8ba4\u4e3a\u662f\u4e00\u79cd\u5148\u8fdb\u7684\u529f\u80fd\uff0c\u4f46\u662f\uff0c\u5982\u679c\u7f13\u5b58\u4e86\u9519\u8bef\u7684\u7ec4\u4ef6\uff08\u6216\u8005\u6b63\u786e\u7684\u7ec4\u4ef6\u5e26\u6709\u9519\u8bef\u7684\u5185\u5bb9\uff09\u5c06\u5bfc\u81f4\u5e94\u7528\u6e32\u67d3\u51fa\u9519\u3002\u7279\u522b\u6ce8\u610f\uff1a<\/p>\n<p class=\"tip\">\u4e0d\u5e94\u8be5\u7f13\u5b58\u7ec4\u4ef6\u5305\u542b\u5b50\u7ec4\u4ef6\u4f9d\u8d56\u5168\u5c40\u72b6\u6001\uff08\u4f8b\u5982\u6765\u81eavuex\u7684\u72b6\u6001\uff09\u3002\u5982\u679c\u8fd9\u4e48\u505a\uff0c\u5b50\u7ec4\u4ef6\uff08\u4e8b\u5b9e\u4e0a\u662f\u6574\u4e2a\u5b50\u6811\uff09\u4e5f\u4f1a\u88ab\u7f13\u5b58\u3002\u6240\u4ee5\u8981\u7279\u522b\u6ce8\u610f\u5e26\u6709slots\u7247\u6bb5\u6216\u8005\u5b50\u7ec4\u4ef6\u7684\u60c5\u51b5\u3002<\/p>\n<h3 id=\"\u8bbe\u7f6e\">\u8bbe\u7f6e<\/h3>\n<p>\u5728\u8b66\u544a\u60c5\u51b5\u4e4b\u5916\u7684\uff0c\u6211\u4eec\u53ef\u4ee5\u7528\u4e0b\u9762\u7684\u65b9\u6cd5\u7f13\u5b58\u7ec4\u4ef6\u3002<\/p>\n<p>\u9996\u5148\uff0c\u4f60\u9700\u8981\u63d0\u4f9b\u7ed9\u6e32\u67d3\u5668\u4e00\u4e2a\u00a0<a href=\"https:\/\/www.npmjs.com\/package\/vue-server-renderer#cache\" target=\"_blank\" rel=\"noopener\">\u7f13\u5b58\u5bf9\u8c61<\/a>\u3002\u8fd9\u6709\u4e2a\u7b80\u5355\u7684\u793a\u4f8b\u4f7f\u7528\u00a0<a href=\"https:\/\/github.com\/isaacs\/node-lru-cache\" target=\"_blank\" rel=\"noopener\">lru-cache<\/a><\/p>\n<pre><code class=\"lang-js\"><span class=\"hljs-keyword\">var<\/span> createRenderer = <span class=\"hljs-built_in\">require<\/span>(<span class=\"hljs-string\">'vue-server-renderer'<\/span>).createRenderer\n<span class=\"hljs-keyword\">var<\/span> lru = <span class=\"hljs-built_in\">require<\/span>(<span class=\"hljs-string\">'lru-cache'<\/span>)\n\n<span class=\"hljs-keyword\">var<\/span> renderer = createRenderer({\n  cache: lru(<span class=\"hljs-number\">1000<\/span>)\n})\n<\/code><\/pre>\n<p>\u8fd9\u5c06\u7f13\u5b58\u9ad8\u8fbe1000\u4e2a\u72ec\u7acb\u7684\u6e32\u67d3\u3002\u5bf9\u4e8e\u66f4\u8fdb\u4e00\u6b65\u7f13\u5b58\u5230\u5185\u5bb9\u4e2d\u7684\u914d\u7f6e\uff0c\u770b<a href=\"https:\/\/github.com\/isaacs\/node-lru-cache#options\" target=\"_blank\" rel=\"noopener\">lru-cache\u8bbe\u7f6e<\/a><\/p>\n<p>\u7136\u540e\u5bf9\u4e8e\u4f60\u60f3\u7f13\u5b58\u7684\u7ec4\u4ef6\uff0c\u4f60\u53ef\u4ee5\u4e3a\u4ed6\u4eec\u63d0\u4f9b\uff1a<\/p>\n<ul>\n<li>\u4e00\u4e2a\u552f\u4e00\u7684<code>\u540d\u5b57<\/code><\/li>\n<li>\u4e00\u4e2a\u00a0<code>serverCacheKey<\/code>\u51fd\u6570\uff0c\u8fd4\u56de\u4e00\u4e2a\u552f\u4e00\u7684\u7ec4\u4ef6\u4f5c\u7528\u57df<\/li>\n<\/ul>\n<p>\u4f8b\u5982:<\/p>\n<pre><code class=\"lang-js\">Vue.component({\n  name: <span class=\"hljs-string\">'list-item'<\/span>,\n  template: <span class=\"hljs-string\">'&lt;li&gt;{{ item.name }}&lt;\/li&gt;'<\/span>,\n  props: [<span class=\"hljs-string\">'item'<\/span>],\n  serverCacheKey: <span class=\"hljs-function\"><span class=\"hljs-keyword\">function<\/span> (<span class=\"hljs-params\">props<\/span>) <\/span>{\n    <span class=\"hljs-keyword\">return<\/span> props.item.type + <span class=\"hljs-string\">'::'<\/span> + props.item.id\n  }\n})\n<\/code><\/pre>\n<h3 id=\"\u7f13\u5b58\u7684\u7406\u60f3\u7ec4\u4ef6\">\u7f13\u5b58\u7684\u7406\u60f3\u7ec4\u4ef6<\/h3>\n<p>\u4efb\u4f55\u7eaf\u7ec4\u4ef6\u53ef\u4ee5\u88ab\u5b89\u5168\u7f13\u5b58 &#8211; \u8fd9\u662f\u4fdd\u8bc1\u7ed9\u4efb\u4f55\u7ec4\u4ef6\u4f20\u9012\u4e00\u6837\u7684\u6570\u636e\u4ea7\u751f\u76f8\u540c\u7684HTML\u3002\u8fd9\u4e9b\u573a\u666f\u7684\u4f8b\u5b50\u5305\u62ec\uff1a<\/p>\n<ul>\n<li>\u9759\u6001\u7684\u7ec4\u4ef6 (\u4f8b\u5982 \u603b\u662f\u5c1d\u8bd5\u4e00\u6837\u7684HTML,\u6240\u4ee5\u00a0<code>serverCacheKey<\/code>\u00a0\u51fd\u6570\u53ef\u4ee5\u88ab\u8fd4\u56de\u00a0<code>true<\/code>)<\/li>\n<li>\u5217\u8868\u7ec4\u4ef6\uff08\u5f53\u6709\u5927\u91cf\u5217\u8868\uff0c\u7f13\u5b58\u4ed6\u4eec\u53ef\u4ee5\u6539\u5584\u6027\u80fd\uff09<\/li>\n<li>\u901a\u7528UI\u7ec4\u4ef6 (\u4f8b\u5982 buttons, alerts, \u7b49\u7b49 &#8211; \u81f3\u5c11\u4ed6\u4eec\u901a\u8fc7props\u83b7\u53d6\u6570\u636e\u800c\u4e0d\u662f slots\u6216\u8005\u5b50\u7ec4\u4ef6)<\/li>\n<\/ul>\n<h2 id=\"\u6784\u5efa\u8fc7\u7a0b\uff0c\u8def\u7531\uff0c\u548cvuex\u72b6\u6001\u7ba1\u7406\">\u6784\u5efa\u8fc7\u7a0b\uff0c\u8def\u7531\uff0c\u548cVuex\u72b6\u6001\u7ba1\u7406<\/h2>\n<p>\u73b0\u5728\uff0c\u5e94\u8be5\u7406\u89e3\u670d\u52a1\u7aef\u6e32\u67d3\u80cc\u540e\u7684\u57fa\u672c\u6982\u5ff5\u4e86\u3002\u4f46\u662f\uff0c\u6784\u5efa\u8fc7\u7a0b\u3001\u8def\u7531\u3001Vuex\u6bcf\u4e00\u4e2a\u90fd\u6709\u81ea\u5df1\u7684\u6ce8\u610f\u4e8b\u9879\u3002<\/p>\n<p>\u8981\u771f\u6b63\u638c\u63e1\u590d\u6742\u5e94\u7528\u4e0b\u7684\u670d\u52a1\u7aef\u6e32\u67d3\uff0c\u6211\u4eec\u63a8\u8350\u6df1\u5ea6\u719f\u6089\u4ee5\u4e0b\u8d44\u6e90\uff1a<\/p>\n<ul>\n<li><a href=\"https:\/\/www.npmjs.com\/package\/vue-server-renderer#api\" target=\"_blank\" rel=\"noopener\">vue-server-renderer \u6587\u6863<\/a>:\u66f4\u591a\u7ec6\u8282\u5728\u8fd9\u91cc\uff0c\u548c\u66f4\u591a\u5148\u8fdb\u7684\u4e3b\u9898\u4e00\u8d77\u7684\u6587\u6863\u3002 \u4f8b\u5982\u00a0<a href=\"https:\/\/www.npmjs.com\/package\/vue-server-renderer#why-use-bundlerenderer\" target=\"_blank\" rel=\"noopener\">preventing cross-request contamination<\/a>\u00a0\u548c\u00a0<a href=\"https:\/\/www.npmjs.com\/package\/vue-server-renderer#creating-the-server-bundle\" target=\"_blank\" rel=\"noopener\">\u6dfb\u52a0\u72ec\u7acb\u7684\u670d\u52a1\u6784\u5efa<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/vuejs\/vue-hackernews-2.0\" target=\"_blank\" rel=\"noopener\">vue-hackernews-2.0<\/a>: \u660e\u786e\u6574\u5408\u4e86 \u6240\u6709\u4e3b\u8981\u7684Vue\u5e93\u548c\u6982\u5ff5\u5728\u5355\u4e2a\u5e94\u7528\u4e2d<\/li>\n<\/ul>\n<hr \/>\n<blockquote><p>\u539f\u6587:\u00a0<a href=\"http:\/\/vuejs.org\/guide\/ssr.html\" target=\"_blank\" rel=\"noopener\">http:\/\/vuejs.org\/guide\/ssr.html<\/a><\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>\u9700\u8981\u670d\u52a1\u7aef\u6e32\u67d3\uff08SSR\uff09\u5417\uff1f \u5728\u5f00\u59cb\u670d\u52a1\u7aef\u6e32\u67d3\u524d\uff0c\u6211\u4eec\u5148\u770b\u770b\u5b83\u80fd\u7ed9\u6211\u4eec\u5e26\u6765\u4ec0\u4e48\uff0c\u4ee5\u53ca\u4ec0\u4e48\u65f6\u5019\u9700\u8981\u7528\u5b83\u3002 SEO&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[5],"tags":[],"_links":{"self":[{"href":"http:\/\/www.33weixin.com\/index\/index.php\/wp-json\/wp\/v2\/posts\/84"}],"collection":[{"href":"http:\/\/www.33weixin.com\/index\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.33weixin.com\/index\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.33weixin.com\/index\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.33weixin.com\/index\/index.php\/wp-json\/wp\/v2\/comments?post=84"}],"version-history":[{"count":1,"href":"http:\/\/www.33weixin.com\/index\/index.php\/wp-json\/wp\/v2\/posts\/84\/revisions"}],"predecessor-version":[{"id":85,"href":"http:\/\/www.33weixin.com\/index\/index.php\/wp-json\/wp\/v2\/posts\/84\/revisions\/85"}],"wp:attachment":[{"href":"http:\/\/www.33weixin.com\/index\/index.php\/wp-json\/wp\/v2\/media?parent=84"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.33weixin.com\/index\/index.php\/wp-json\/wp\/v2\/categories?post=84"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.33weixin.com\/index\/index.php\/wp-json\/wp\/v2\/tags?post=84"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}