{"id":2711,"date":"2020-04-17T13:37:57","date_gmt":"2020-04-17T05:37:57","guid":{"rendered":"http:\/\/www.yuguoxy.com\/geekhome\/?p=2711"},"modified":"2026-08-18T12:35:28","modified_gmt":"2026-08-18T04:35:28","slug":"%e6%b5%85%e8%b0%88%e8%87%aa%e5%b7%b1%e7%9f%a5%e9%81%93%e7%9a%84%e9%a6%96%e5%b1%8f%e5%8a%a0%e8%bd%bd%e6%97%b6%e9%97%b4%e7%9a%84%e4%bc%98%e5%8c%96%e7%ad%96%e7%95%a5","status":"publish","type":"post","link":"https:\/\/ai.zhousir.top\/?p=2711","title":{"rendered":"\u6d45\u8c08\u81ea\u5df1\u77e5\u9053\u7684\u9996\u5c4f\u52a0\u8f7d\u65f6\u95f4\u7684\u4f18\u5316\u7b56\u7565"},"content":{"rendered":"<section id=\"wenyan\" style=\"font-family: system-ui, 'Apple Color Emoji', 'Segoe UI', 'Segoe UI Symbol', 'Noto Sans', Roboto, sans-serif; line-height: 1.75; font-size: 16px; color: #000000; caret-color: #000000;\" data-provider=\"WenYan\">\n<p style=\"margin: 1em 0px;\">SPA \u5df2\u6210\u4e3b\u6d41\uff0c<strong style=\"color: #4870ac;\">Angular<\/strong>\u3001<strong style=\"color: #4870ac;\">React<\/strong>\u3001<strong style=\"color: #4870ac;\">Vue<\/strong> \u4e09\u5206\u5929\u4e0b\u3002\u5355\u9875\u5e94\u7528\u9996\u5c4f\u6162\u3001\u4e0d\u5229\u4e8e SEO\uff0c\u6240\u4ee5 vue \/ react \u5168\u5bb6\u6876\u90fd\u4f1a\u628a\u670d\u52a1\u7aef\u6e32\u67d3\u5f53\u6210\u8def\u7531\u843d\u5730\u7684\u9009\u9879\u4e4b\u4e00\u3002<\/p>\n<p style=\"margin: 1em 0px;\">\u670d\u52a1\u7aef\u6e32\u67d3\u7684\u610f\u601d\u662f\uff1a\u7528\u6237\u7b2c\u4e00\u6b21\u8bf7\u6c42\u65f6\uff0c\u670d\u52a1\u5668\u628a\u7ec4\u4ef6\u6e32\u67d3\u6210 HTML \u5b57\u7b26\u4e32\u518d\u8fd4\u56de\u3002\u5ba2\u6237\u7aef\u62ff\u5230\u7684\u5c31\u662f\u53ef\u76f4\u63a5\u5448\u73b0\u7684 HTML\uff0c\u4e0d\u5fc5\u5148\u8dd1\u4e00\u904d JS \u518d\u751f\u6210 DOM\u3002\u6e90\u7801\u91cc\u80fd\u770b\u5230\u9875\u9762\u4e0a\u7684\u5185\u5bb9\uff0c\u4e5f\u5c31\u662f\u201c\u6240\u89c1\u5373\u6240\u5f97\u201d\u3002<\/p>\n<p style=\"margin: 1em 0px;\">\u5ba2\u6237\u7aef\u6e32\u67d3\u548c SSR \u672c\u8d28\u90fd\u662f\u5b57\u7b26\u4e32\u62fc\u63a5\uff1a\u628a\u6570\u636e\u586b\u8fdb\u56fa\u5b9a HTML\u3002\u62fc\u5728\u670d\u52a1\u5668\u4e0a\u5c31\u8017 server\uff1b\u62fc\u5728\u6d4f\u89c8\u5668\u4e0a\uff0c\u5e38\u89c1\u505a\u6cd5\u662f\u63d2 DOM \u6216\u7528\u6a21\u677f\u5f15\u64ce\u66ff\u6362 <code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; color: #4870ac; font-size: 0.9em; font-weight: normal; overflow-wrap: break-word; padding: 2px 4px; border-radius: 3px; margin: 2px; background-color: #f6f8fa; word-break: break-all;\">{{text}}<\/code> \u4e00\u7c7b\u6807\u8bb0\u3002\u7528\u8fc7\u6846\u67b6\u90fd\u77e5\u9053\uff0cSPA \u6700\u5927\u77ed\u677f\u5c31\u662f\u9996\u5c4f\u65f6\u95f4\u957f\uff0c\u4e0b\u9762\u6309\u6211\u5b9e\u9645\u8e29\u8fc7\u7684\u5751\u6574\u7406\u4e94\u6761\u7b56\u7565\u3002<\/p>\n<table style=\"display: table; text-align: left; overflow: auto; border-collapse: collapse; margin: 1.4em auto; max-width: 100%; table-layout: fixed; overflow-wrap: break-word; word-break: break-all;\" width=\"800\">\n<thead>\n<tr>\n<th style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top; text-align: center; font-weight: bold; color: #4870ac; background: #f7f7f7;\">\u7b56\u7565<\/th>\n<th style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top; text-align: center; font-weight: bold; color: #4870ac; background: #f7f7f7;\">\u6838\u5fc3\u6536\u76ca<\/th>\n<th style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top; text-align: center; font-weight: bold; color: #4870ac; background: #f7f7f7;\">\u4e3b\u8981\u4ee3\u4ef7<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">\u7f29\u5c0f\u6253\u5305\u4f53\u79ef<\/td>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">\u5c11\u4f20 JS\uff0c\u89e3\u6790\u66f4\u5feb<\/td>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">\u8981\u6309\u9700\u5f15\u5165\u3001\u4f1a\u67e5\u4f9d\u8d56<\/td>\n<\/tr>\n<tr>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">\u670d\u52a1\u7aef\u6e32\u67d3 SSR<\/td>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">\u9996\u5c4f\u6709\u5185\u5bb9\u3001\u5229\u4e8e SEO<\/td>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">\u5fc5\u987b Node\uff0c\u914d\u7f6e\u91cd<\/td>\n<\/tr>\n<tr>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">\u9884\u6e32\u67d3<\/td>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">\u9759\u6001 HTML \u5148\u51fa\u6765\uff0c\u914d\u7f6e\u76f8\u5bf9\u7b80\u5355<\/td>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">\u9875\u9762\u591a\u65f6 build \u5f88\u6162<\/td>\n<\/tr>\n<tr>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">gzip<\/td>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">\u4f20\u8f93\u4f53\u79ef\u53ef\u538b\u5230\u7ea6 30%<\/td>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">\u8981\u670d\u52a1\u5668\u914d\u5408<\/td>\n<\/tr>\n<tr>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">\u8def\u7531\/\u7ec4\u4ef6\u61d2\u52a0\u8f7d<\/td>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">\u9996\u5305\u53ea\u542b\u5f53\u524d\u9875<\/td>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">\u8bf7\u6c42\u6b21\u6570\u53d8\u591a\uff0c\u9760\u7f13\u5b58\u515c\u5e95<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2 style=\"padding: 1px 12.5px; color: #ffffff; margin: 1.2em 0px 1em; border-radius: 4px; display: inline-block; background-color: #4870ac; font-size: 1.3em;\">\u4e00\u3001\u7f29\u5c0f\u6253\u5305\u4f53\u79ef<\/h2>\n<p style=\"margin: 1em 0px;\">\u751f\u4ea7\u4f9d\u8d56\u5c3d\u91cf\u5c11\uff0c\u6309\u9700\u5f15\u7528\uff0c\u522b\u8ba9\u65e0\u7528\u4ee3\u7801\u8fdb\u5305\u3002\u521a\u5f00\u59cb\u4f18\u5316\u65f6\u5f80\u5f80\u4e0d\u77e5\u9053\u54ea\u4e2a\u5e93\u5360\u7a7a\u95f4\uff0c\u751a\u81f3\u4f1a\u6328\u4e2a\u5220\u5f15\u7528\u8bd5\u3002\u540e\u6765\u624d\u7528\u4e0a <code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; color: #4870ac; font-size: 0.9em; font-weight: normal; overflow-wrap: break-word; padding: 2px 4px; border-radius: 3px; margin: 2px; background-color: #f6f8fa; word-break: break-all;\">webpack-bundle-analyzer<\/code>\uff1a\u56fe\u91cc\u9762\u79ef\u8d8a\u5927\uff0c\u5360\u5f97\u8d8a\u591a\u3002<\/p>\n<p style=\"margin: 1em 0px;\">\u5148\u88c5\u63d2\u4ef6\uff1a<\/p>\n<pre style=\"overflow: auto hidden; word-break: normal; white-space: pre; tab-size: 2; border-radius: 5px; line-height: 2; margin: 1em 0.5em; padding: 0.5em; box-shadow: rgba(0, 0, 0, 0.55) 0px 1px 5px; font-size: 12px; background: #002b36; max-width: 100%; overflow-wrap: normal;\"><code class=\"hljs\" style=\"word-break: normal; white-space: nowrap; tab-size: 2; font-size: 12px; font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; display: block; overflow-x: auto; margin: 0.5em; padding: 3px 5px; color: #93a1a1; background: #002b36; overflow-wrap: normal;\">npm install --save-dev webpack-bundle-analyzer<\/code><\/pre>\n<p style=\"margin: 1em 0px;\">\u518d\u5728 <code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; color: #4870ac; font-size: 0.9em; font-weight: normal; overflow-wrap: break-word; padding: 2px 4px; border-radius: 3px; margin: 2px; background-color: #f6f8fa; word-break: break-all;\">webpack.prod.conf.js<\/code> \u91cc\u914d\u7f6e\uff1a<\/p>\n<pre style=\"overflow: auto hidden; word-break: normal; white-space: pre; tab-size: 2; border-radius: 5px; line-height: 2; margin: 1em 0.5em; padding: 0.5em; box-shadow: rgba(0, 0, 0, 0.55) 0px 1px 5px; font-size: 12px; background: #002b36; max-width: 100%; overflow-wrap: normal;\"><code class=\"hljs\" style=\"word-break: normal; white-space: nowrap; tab-size: 2; font-size: 12px; font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; display: block; overflow-x: auto; margin: 0.5em; padding: 3px 5px; color: #93a1a1; background: #002b36; overflow-wrap: normal;\">const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;\nplugins: [\nnew BundleAnalyzerPlugin(\n     {\n          analyzerMode: 'server',\n          analyzerHost: '127.0.0.1',\n          analyzerPort: 8888, \/\/ \u8fd0\u884c\u540e\u7684\u7aef\u53e3\u53f7\n          reportFilename: 'report.html',\n          defaultSizes: 'parsed',\n          openAnalyzer: true,\n          generateStatsFile: false,\n          statsFilename: 'stats.json',\n          statsOptions: null,\n          logLevel: 'info'\n        }\n     ),\n]<\/code><\/pre>\n<p style=\"margin: 1em 0px;\">\u6b63\u5e38 <code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; color: #4870ac; font-size: 0.9em; font-weight: normal; overflow-wrap: break-word; padding: 2px 4px; border-radius: 3px; margin: 2px; background-color: #f6f8fa; word-break: break-all;\">npm run build<\/code> \u7ed3\u675f\u540e\u4f1a\u5728\u9ed8\u8ba4\u6d4f\u89c8\u5668\u6253\u5f00\u6a21\u5757\u7ec4\u6210\u56fe\u3002<\/p>\n<p style=\"margin: 1em 0px;\"><a href=\"https:\/\/ai.zhousir.top\/wp-content\/uploads\/2020\/04\/\u256c\u0432\u2568\u253c\u255c\u256a\u2550\u255d_20200415133730.png\" rel=\"fancybox\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone  wp-image-2713\" src=\"https:\/\/ai.zhousir.top\/wp-content\/uploads\/2020\/04\/\u256c\u0432\u2568\u253c\u255c\u256a\u2550\u255d_20200415133730.png\" alt=\"\u256c\u0432\u2568\u253c\u255c\u256a\u2550\u255d_20200415133730\" width=\"629\" height=\"310\" \/><\/a><\/p>\n<p style=\"margin: 1em 0px;\">\u4e0a\u56fe\u91cc vue \u6a21\u5757\u9762\u79ef\u6700\u5927\uff0c\u53ef\u4ee5\u6309\u8fd9\u5757\u4e0b\u624b\uff0c\u4e0d\u4f1a\u518d\u65e0\u4ece\u4e0b\u624b\u3002<\/p>\n<p style=\"margin: 1em 0px;\">\u518d\u8bb0\u4e00\u4e2a <code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; color: #4870ac; font-size: 0.9em; font-weight: normal; overflow-wrap: break-word; padding: 2px 4px; border-radius: 3px; margin: 2px; background-color: #f6f8fa; word-break: break-all;\">element-ui<\/code> \u7684\u5751\uff1a\u5168\u5c40\u5f15\u5165\u65f6 vendor \u81f3\u5c11 700KB\u3002\u6539\u6210\u5c40\u90e8\u5f15\u5165\uff0c<code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; color: #4870ac; font-size: 0.9em; font-weight: normal; overflow-wrap: break-word; padding: 2px 4px; border-radius: 3px; margin: 2px; background-color: #f6f8fa; word-break: break-all;\">main.js<\/code> \u7c7b\u4f3c\uff1a<\/p>\n<pre style=\"overflow: auto hidden; word-break: normal; white-space: pre; tab-size: 2; border-radius: 5px; line-height: 2; margin: 1em 0.5em; padding: 0.5em; box-shadow: rgba(0, 0, 0, 0.55) 0px 1px 5px; font-size: 12px; background: #002b36; max-width: 100%; overflow-wrap: normal;\"><code class=\"hljs\" style=\"word-break: normal; white-space: nowrap; tab-size: 2; font-size: 12px; font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; display: block; overflow-x: auto; margin: 0.5em; padding: 3px 5px; color: #93a1a1; background: #002b36; overflow-wrap: normal;\">import {\n  Autocomplete,\n  Checkbox\n  \u2026\u2026\n} from 'element-ui'\nVue.use(Autocomplete);\nVue.use(Checkbox);<\/code><\/pre>\n<p style=\"margin: 1em 0px;\">\u7ed3\u679c\u4f53\u79ef\u5b8c\u5168\u6ca1\u53d8\u3002\u5b98\u65b9\u6587\u6863\u8fd8\u8981\u6c42\u88c5 <code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; color: #4870ac; font-size: 0.9em; font-weight: normal; overflow-wrap: break-word; padding: 2px 4px; border-radius: 3px; margin: 2px; background-color: #f6f8fa; word-break: break-all;\">babel-plugin-component<\/code>\uff0c\u5c40\u90e8\u5f15\u7528\u624d\u751f\u6548\u3002\u770b\u6587\u6863\u4e00\u5b9a\u8981\u7ec6\u3002<\/p>\n<h2 style=\"padding: 1px 12.5px; color: #ffffff; margin: 1.2em 0px 1em; border-radius: 4px; display: inline-block; background-color: #4870ac; font-size: 1.3em;\">\u4e8c\u3001\u670d\u52a1\u7aef\u6e32\u67d3<\/h2>\n<p style=\"margin: 1em 0px;\">\u8fd9\u91cc\u7684 SSR \u4e0d\u662f\u4f20\u7edf\u540e\u7aef\u62fc\u9875\u9762\uff0c\u800c\u662f\u628a\u524d\u7aef\u6846\u67b6\u7684\u4e00\u90e8\u5206 JS \u653e\u5230\u670d\u52a1\u5668\u4e0a\u8dd1\uff0c\u6d4f\u89c8\u5668\u62ff\u5230\u7684\u5c31\u4e0d\u662f\u7a7a\u58f3 HTML\u3002\u767d\u5c4f\u65f6\u95f4\u4f1a\u77ed\uff0c\u641c\u7d22\u5f15\u64ce\u4e5f\u66f4\u5bb9\u6613\u6536\u5f55\u3002<\/p>\n<p style=\"margin: 1em 0px;\">\u5c40\u9650\u4e5f\u5f88\u660e\u786e\uff1a\u670d\u52a1\u7aef\u5fc5\u987b\u662f Node\uff0c\u4e0d\u80fd\u53ea\u4e22\u9759\u6001\u670d\u52a1\u5668\u3002Vue \u5b98\u65b9 SSR \u914d\u7f6e\u590d\u6742\uff0c\u4ece vue-cli \u9879\u76ee\u4e2d\u9014\u6539 SSR \u5f88\u9ebb\u70e6\u3002\u771f\u8981\u8d70 SSR\uff0c\u5f00\u5de5\u5c31\u7528 <strong style=\"color: #4870ac;\">Nuxt.js<\/strong> \u66f4\u7701\u4e8b\u3002<\/p>\n<p style=\"margin: 1em 0px;\">\u548c\u5ba2\u6237\u7aef\u6e32\u67d3\u5bf9\u6bd4\uff1a\u9996\u5c4f\u53ea\u9700\u5f53\u524d\u9875\u5185\u5bb9\uff0c\u4e0d\u5fc5\u50cf React \/ Vue CSR \u90a3\u6837\u5148\u62c9\u5b8c\u6574 JS\uff1bSEO \u65b9\u9762\uff0c\u641c\u7d22\u5f15\u64ce\u4e5f\u6536\u4e0d\u5230\u201cajax \u62c9\u5b8c\u6570\u636e\u518d\u52a8\u6001\u6e32\u67d3\u201d\u7684\u90a3\u4e00\u7248\u9875\u9762\u3002<\/p>\n<ul style=\"padding-left: 1rem; margin-left: 1rem; font-size: 0.9rem; list-style-type: disc;\">\n<li>\n<section>\u597d\u5904\uff1a\u9996\u5c4f\u5feb\u3001\u5229\u4e8e SEO\u3001\u53ef\u505a\u7f13\u5b58\u7247\u6bb5\u548c\u9759\u6001\u5316\uff0c\u76f8\u5bf9\u5ba2\u6237\u7aef\u6e32\u67d3\u66f4\u7701\u7535\u3002<\/section>\n<\/li>\n<li>\n<section>\u574f\u5904\uff1a\u4ea4\u4e92\u4f53\u9a8c\u5f80\u5f80\u4e0d\u5982 CSR\uff1b\u524d\u7aef\u6539 HTML\/CSS\uff0c\u540e\u7aef\u4e5f\u5e38\u8981\u8ddf\u7740\u6539\u3002<\/section>\n<\/li>\n<\/ul>\n<h2 style=\"padding: 1px 12.5px; color: #ffffff; margin: 1.2em 0px 1em; border-radius: 4px; display: inline-block; background-color: #4870ac; font-size: 1.3em;\">\u4e09\u3001\u9884\u6e32\u67d3<\/h2>\n<p style=\"margin: 1em 0px;\">\u6253\u5305\u65f6\u9884\u5148\u8dd1\u4e00\u904d JS\uff0c\u628a\u4e00\u90e8\u5206\u9759\u6001\u9875\u5199\u6210 HTML \u585e\u8fdb\u751f\u6210\u7684 <code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; color: #4870ac; font-size: 0.9em; font-weight: normal; overflow-wrap: break-word; padding: 2px 4px; border-radius: 3px; margin: 2px; background-color: #f6f8fa; word-break: break-all;\">index.html<\/code>\u3002HTML \u52a0\u8f7d\u5b8c\u5c31\u80fd\u770b\u5230\u754c\u9762\uff0c\u4e0d\u5fc5\u7b49 JS \u518d\u6e32\u67d3\u3002\u9996\u5c4f\u548c SEO \u90fd\u80fd\u6539\u5584\uff0c\u914d\u7f6e\u4e5f\u6bd4 SSR \u7b80\u5355\u3002<\/p>\n<p style=\"margin: 1em 0px;\">\u9875\u9762\u5f88\u591a\u65f6 build \u4f1a\u975e\u5e38\u6162\u3002\u5e38\u89c1\u5de5\u5177\uff1a<\/p>\n<pre style=\"overflow: auto hidden; word-break: normal; white-space: pre; tab-size: 2; border-radius: 5px; line-height: 2; margin: 1em 0.5em; padding: 0.5em; box-shadow: rgba(0, 0, 0, 0.55) 0px 1px 5px; font-size: 12px; background: #002b36; max-width: 100%; overflow-wrap: normal;\"><code class=\"hljs\" style=\"word-break: normal; white-space: nowrap; tab-size: 2; font-size: 12px; font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; display: block; overflow-x: auto; margin: 0.5em; padding: 3px 5px; color: #93a1a1; background: #002b36; overflow-wrap: normal;\">prerender-spa-plugin\nreact-snap\nsnapshotify\npresite<\/code><\/pre>\n<p style=\"margin: 1em 0px;\">\u539f\u7406\u5dee\u4e0d\u591a\uff1a\u672c\u5730\u8dd1\u6307\u5b9a JS\uff0c\u628a\u65e0\u5934\u6d4f\u89c8\u5668\u6e32\u67d3\u51fa\u7684\u9875\u9762\u5199\u5165\u76ee\u6807 HTML\u3002\u6211\u81ea\u5df1\u6253\u5305\u65f6\u5404\u79cd\u62a5\u9519\uff0c\u51e0\u4e2a\u63d2\u4ef6\u8f6e\u4e86\u4e00\u904d\u4e5f\u6ca1\u5f97\u5230\u6ee1\u610f\u9875\u9762\u2014\u2014\u90a3\u662f\u6211\u7684\u95ee\u9898\uff0c\u4e0d\u662f\u8f6e\u5b50\u7684\u95ee\u9898\u3002<\/p>\n<p style=\"margin: 1em 0px;\">\u6700\u540e\u7528\u4e86\u201c\u571f\u529e\u6cd5\u201d\uff1a\u6d4f\u89c8\u5668\u6253\u5f00\u76ee\u6807\u9875\uff0c\u53f3\u952e\u53e6\u5b58\u4e3a\uff0c\u5f97\u5230\u9884\u6e32\u67d3 HTML\u3002CSS \u592a\u591a\u5c31\u7528 Chrome \u63d2\u4ef6 <strong style=\"color: #4870ac;\">css used<\/strong>\uff08\u5f00\u53d1\u8005\u5de5\u5177 Element \u91cc\u548c Style \u5e76\u6392\uff09\uff0c\u53ea\u7559\u4e0b\u7528\u5230\u7684 CSS\u3002\u518d\u628a\u6253\u5305\u751f\u6210\u7684 JS\/CSS \u8def\u5f84\u5199\u56de\u53bb\uff08\u548c\u6b63\u5f0f <code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; color: #4870ac; font-size: 0.9em; font-weight: normal; overflow-wrap: break-word; padding: 2px 4px; border-radius: 3px; margin: 2px; background-color: #f6f8fa; word-break: break-all;\">index.html<\/code> \u4e00\u6837\uff09\u3002HTML \u5148\u753b\u51fa\u9884\u6e32\u67d3\u9875\uff0c\u4f9d\u8d56\u52a0\u8f7d\u5b8c\u540e\u518d\u88ab\u6b63\u5f0f\u4ee3\u7801\u8986\u76d6\u3002<\/p>\n<p style=\"margin: 1em 0px;\">\u571f\u5f52\u571f\uff0c\u9996\u5c4f\u65f6\u95f4\u5927\u7ea6\u77ed\u4e86 50%\u3002\u4e5f\u53ef\u4ee5\u5148\u505a\u9aa8\u67b6\u5c4f\uff0c\u7b49 JS\/CSS \u65f6\u53ea\u663e\u793a\u6846\u67b6\uff0c\u6bd4\u5168\u767d\u5c4f\u597d\u53d7\u5f97\u591a\u3002<\/p>\n<h2 style=\"padding: 1px 12.5px; color: #ffffff; margin: 1.2em 0px 1em; border-radius: 4px; display: inline-block; background-color: #4870ac; font-size: 1.3em;\">\u56db\u3001\u7528 gzip \u51cf\u5c0f\u4f20\u8f93\u4f53\u79ef<\/h2>\n<p style=\"margin: 1em 0px;\">gzip \u6700\u65e9\u7528\u4e8e UNIX \u6587\u4ef6\u538b\u7f29\u3002HTTP \u4e0a\u7684 gzip \u8981\u670d\u52a1\u5668\u548c\u6d4f\u89c8\u5668\u90fd\u652f\u6301\u3002Chrome\u3001Firefox\u3001IE \u4ee5\u53ca Apache\u3001Nginx\u3001IIS \u90fd\u652f\u6301\u3002\u9759\u6001\u6587\u4ef6\u5e38\u80fd\u538b\u5230\u7ea6 30%\uff0c\u5bf9\u9996\u5c4f\u5f88\u5212\u7b97\uff0c\u914d\u7f6e\u670d\u52a1\u5668\u5373\u53ef\u3002<\/p>\n<p style=\"margin: 1em 0px;\">\u4ee5 Nginx \u4e3a\u4f8b\uff1a<\/p>\n<pre style=\"overflow: auto hidden; word-break: normal; white-space: pre; tab-size: 2; border-radius: 5px; line-height: 2; margin: 1em 0.5em; padding: 0.5em; box-shadow: rgba(0, 0, 0, 0.55) 0px 1px 5px; font-size: 12px; background: #002b36; max-width: 100%; overflow-wrap: normal;\"><code class=\"hljs\" style=\"word-break: normal; white-space: nowrap; tab-size: 2; font-size: 12px; font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; display: block; overflow-x: auto; margin: 0.5em; padding: 3px 5px; color: #93a1a1; background: #002b36; overflow-wrap: normal;\">http {\n    include       mime.types;\n    default_type  application\/octet-stream;\n    sendfile        on;\n    keepalive_timeout  65;\n    proxy_buffering on;\n\u5f00\u542fgzip\n\tgzip on;\n\t# \u542f\u7528gzip\u538b\u7f29\u7684\u6700\u5c0f\u6587\u4ef6\uff0c\u5c0f\u4e8e\u8bbe\u7f6e\u503c\u7684\u6587\u4ef6\u5c06\u4e0d\u4f1a\u538b\u7f29\n\tgzip_min_length 1k;\n\t# gzip \u538b\u7f29\u7ea7\u522b\uff0c1-10\uff0c\u6570\u5b57\u8d8a\u5927\u538b\u7f29\u7684\u8d8a\u597d\uff0c\u4e5f\u8d8a\u5360\u7528CPU\u65f6\u95f4\n\tgzip_comp_level 2;\n\t# \u8fdb\u884c\u538b\u7f29\u7684\u6587\u4ef6\u7c7b\u578b\u3002javascript\u6709\u591a\u79cd\u5f62\u5f0f\u3002\u5176\u4e2d\u7684\u503c\u53ef\u4ee5\u5728 mime.types \u6587\u4ef6\u4e2d\u627e\u5230\u3002\n\tgzip_types text\/plain application\/javascript application\/x-javascript text\/css application\/xml text\/javascript application\/x-httpd-php image\/jpeg image\/gif image\/png font\/ttf font\/otf image\/svg+xml;\n\t# \u662f\u5426\u5728http header\u4e2d\u6dfb\u52a0Vary: Accept-Encoding\uff0c\u5efa\u8bae\u5f00\u542f\n\tgzip_vary on;\n\t# \u7981\u7528IE 6 gzip\n\tgzip_disable \"MSIE [1-6]\\.\";\n\tserver {\n        listen       80;\n        server_name  localhost;\n        location \/{\n            alias \/;\n            proxy_connect_timeout 1; \n            proxy_send_timeout 30; \n            proxy_read_timeout 60;\n            # \u8fd9\u91cc\u53cd\u5411\u4ee3\u7406\u5230\u672c\u5730\u7684\u5f00\u53d1\u670d\u52a1\u5668\u4e0a\n            proxy_pass http:\/\/localhost:8080\/;\n         }\n    }\n}<\/code><\/pre>\n<p style=\"margin: 1em 0px;\">\u8fd9\u6837 gzip \u5c31\u5f00\u4e86\u3002<\/p>\n<h2 style=\"padding: 1px 12.5px; color: #ffffff; margin: 1.2em 0px 1em; border-radius: 4px; display: inline-block; background-color: #4870ac; font-size: 1.3em;\">\u4e94\u3001\u6309\u9875\u9762\u6216\u7ec4\u4ef6\u61d2\u52a0\u8f7d<\/h2>\n<p style=\"margin: 1em 0px;\">\u6bcf\u4e2a\u7ec4\u4ef6\u7684 JS \u72ec\u7acb\u51fa\u53bb\uff0c\u7528\u5230\u518d\u8bf7\u6c42\uff1b\u8bf7\u6c42\u8fc7\u4e00\u6b21\u4f1a\u7f13\u5b58\uff0c\u518d\u7528\u5c31\u8d70\u7f13\u5b58\u3002vue-router \u91cc\u6539\u4e00\u4e0b\u5373\u53ef\uff1a<\/p>\n<pre style=\"overflow: auto hidden; word-break: normal; white-space: pre; tab-size: 2; border-radius: 5px; line-height: 2; margin: 1em 0.5em; padding: 0.5em; box-shadow: rgba(0, 0, 0, 0.55) 0px 1px 5px; font-size: 12px; background: #002b36; max-width: 100%; overflow-wrap: normal;\"><code class=\"hljs\" style=\"word-break: normal; white-space: nowrap; tab-size: 2; font-size: 12px; font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; display: block; overflow-x: auto; margin: 0.5em; padding: 3px 5px; color: #93a1a1; background: #002b36; overflow-wrap: normal;\">import Vue from 'vue'\nimport Router from 'vue-router'\n\nVue.use(Router);\n\nexport default new Router({\n  mode: 'history',\n  linkActiveClass: 'router-link-active',\n  routes: [\n    {\n      path: '\/',\n      \/\/ \u8fd9\u91cc\u53ea\u9700\u8981\u628a\u539f\u6765\u4ece\u5916\u90e8\u5f15\u5165\u7684\u7ec4\u4ef6\u6362\u6210\u4ee5\u4e0b\u7684\u8bed\u53e5\u5c31\u53ef\u4ee5\u4e86\n      component: resolve =&gt; require(['..\/components\/(\u4f60\u7684\u7ec4\u4ef6)'], resolve)\n    },\n  ]\n})<\/code><\/pre>\n<p style=\"margin: 1em 0px;\">\u522b\u5904\u4e0d\u7528\u6539\u3002\u6253\u5305\u540e JS \u6587\u4ef6\u4f1a\u6bd4\u4e0d\u5206\u5757\u65f6\u591a\u4e0d\u5c11\u3002<\/p>\n<p style=\"margin: 1em 0px;\">\u4ee5\u4e0a\u662f\u6211\u7528\u8fc7\u7684 SPA \u9996\u5c4f\u4f18\u5316\u3002\u66f4\u591a\u4f18\u5316\u89c1 <a href=\"https:\/\/www.cnblogs.com\/mianbaodaxia\/p\/10751453.html\">https:\/\/www.cnblogs.com\/mianbaodaxia\/p\/10751453.html<\/a>\u3002<\/p>\n<blockquote style=\"display: block; font-size: 0.9em; border-left: 3px solid #4870ac; padding: 0.5em 1em; margin: 0px; background: #f6f8fa; color: #40464f;\">\n<p style=\"margin: 1em 0px;\"><strong style=\"color: #4870ac;\">\u4e00\u53e5\u8bdd\u603b\u7ed3\uff1a\u9996\u5c4f\u4f18\u5316\u662f\u7ec4\u5408\u62f3\uff1a\u5148\u770b\u6e05\u5305\u4f53\u79ef\uff0c\u518d\u6309\u573a\u666f\u9009 SSR\u3001\u9884\u6e32\u67d3\u3001gzip \u548c\u61d2\u52a0\u8f7d\uff0c\u800c\u4e0d\u662f\u4e00\u4e0a\u6765\u5c31\u6539\u67b6\u6784\u3002<\/strong><\/p>\n<\/blockquote>\n<\/section>\n","protected":false},"excerpt":{"rendered":"<p>SPA \u5df2\u6210\u4e3b\u6d41\uff0cAngular\u3001React\u3001Vue \u4e09\u5206\u5929\u4e0b\u3002\u5355\u9875\u5e94\u7528\u9996\u5c4f\u6162\u3001\u4e0d\u5229\u4e8e SEO\uff0c\u6240\u4ee5 vue  [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[105,127],"tags":[209],"_links":{"self":[{"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=\/wp\/v2\/posts\/2711"}],"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=2711"}],"version-history":[{"count":3,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=\/wp\/v2\/posts\/2711\/revisions"}],"predecessor-version":[{"id":2914,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=\/wp\/v2\/posts\/2711\/revisions\/2914"}],"wp:attachment":[{"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2711"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2711"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2711"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}