{"id":1399,"date":"2024-06-02T22:43:20","date_gmt":"2024-06-02T22:43:20","guid":{"rendered":""},"modified":"2024-06-05T06:12:19","modified_gmt":"2024-06-04T22:12:19","slug":"vuepress-%e5%8d%9a%e5%ae%a2%e4%bc%98%e5%8c%96%e4%b9%8b%e5%85%bc%e5%ae%b9-pwa","status":"publish","type":"post","link":"https:\/\/www.lccc.top\/?p=1399","title":{"rendered":"VuePress \u535a\u5ba2\u4f18\u5316\u4e4b\u517c\u5bb9 PWA"},"content":{"rendered":"<td class=\"d-block comment-body markdown-body  js-comment-body\">\n<h2 dir=\"auto\">\u524d\u8a00<\/h2>\n<p dir=\"auto\">\u5728 <a href=\"https:\/\/github.com\/mqyqingfeng\/Blog\/issues\/235\" data-hovercard-type=\"issue\" data-hovercard-url=\"\/mqyqingfeng\/Blog\/issues\/235\/hovercard\">\u300a\u4e00\u7bc7\u5e26\u4f60\u7528 VuePress + Github Pages \u642d\u5efa\u535a\u5ba2\u300b<\/a>\u4e2d\uff0c\u6211\u4eec\u4f7f\u7528 VuePress \u642d\u5efa\u4e86\u4e00\u4e2a\u535a\u5ba2\uff0c\u6700\u7ec8\u7684\u6548\u679c\u67e5\u770b\uff1a<a href=\"http:\/\/ts.yayujs.com\/\" rel=\"nofollow\">TypeScript \u4e2d\u6587\u6587\u6863<\/a>\u3002<\/p>\n<p dir=\"auto\">\u672c\u7bc7\u6211\u4eec\u8bb2\u8bb2\u5982\u4f55\u517c\u5bb9 PWA\u3002<\/p>\n<h2 dir=\"auto\">PWA<\/h2>\n<p dir=\"auto\">PWA\uff0c\u82f1\u6587\u5168\u79f0\uff1a<code class=\"notranslate\">Progressive Web Apps<\/code>\uff0c \u4e2d\u6587\u7ffb\u8bd1\uff1a<strong>\u6e10\u8fdb\u5f0f Web \u5e94\u7528<\/strong>\u3002<\/p>\n<p dir=\"auto\">\u5f15\u7528 <a href=\"https:\/\/developer.mozilla.org\/zh-CN\/docs\/Web\/Progressive_web_apps\/Introduction\" rel=\"nofollow\">MDN<\/a> \u7684\u4ecb\u7ecd\uff1a<\/p>\n<blockquote>\n<p dir=\"auto\">PWA \u6307\u7684\u662f\u4f7f\u7528\u6307\u5b9a\u6280\u672f\u548c\u6807\u51c6\u6a21\u5f0f\u6765\u5f00\u53d1\u7684 Web \u5e94\u7528\uff0c\u8fd9\u540c\u65f6\u8d4b\u4e88\u5b83\u4eec Web \u5e94\u7528\u548c\u539f\u751f\u5e94\u7528\u7684\u7279\u6027\u3002<\/p>\n<p dir=\"auto\">\u4f8b\u5982\u4e00\u65b9\u9762\uff0cWeb \u5e94\u7528\u66f4\u52a0\u6613\u4e8e\u53d1\u73b0\uff1a\u76f8\u6bd4\u4e8e\u5b89\u88c5\u5e94\u7528\uff0c\u8bbf\u95ee\u4e00\u4e2a\u7f51\u7ad9\u663e\u7136\u66f4\u52a0\u5bb9\u6613\u548c\u8fc5\u901f\u3002\u4f60\u8fd8\u53ef\u4ee5\u901a\u8fc7\u94fe\u63a5\u6765\u5206\u4eab Web \u5e94\u7528\u3002<\/p>\n<p dir=\"auto\">\u53e6\u4e00\u65b9\u9762\uff0c\u539f\u751f\u5e94\u7528\u4e0e\u64cd\u4f5c\u7cfb\u7edf\u53ef\u4ee5\u66f4\u52a0\u5b8c\u7f8e\u7684\u6574\u5408\uff0c\u4e5f\u56e0\u6b64\u4e3a\u7528\u6237\u63d0\u4f9b\u4e86\u65e0\u7f1d\u7684\u7528\u6237\u4f53\u9a8c\u3002\u4f60\u53ef\u4ee5\u901a\u8fc7\u5b89\u88c5\u5e94\u7528\u4f7f\u5f97\u5b83\u5728\u79bb\u7ebf\u7684\u72b6\u6001\u4e0b\u4e5f\u53ef\u4ee5\u8fd0\u884c\uff1b\u76f8\u8f83\u4e8e\u4f7f\u7528\u6d4f\u89c8\u5668\u8bbf\u95ee\uff0c\u7528\u6237\u4e5f\u66f4\u559c\u6b22\u901a\u8fc7\u70b9\u51fb\u4e3b\u9875\u4e0a\u7684\u56fe\u6807\u6765\u8bbf\u95ee\u5b83\u4eec\u559c\u7231\u7684\u5e94\u7528\u3002<\/p>\n<p dir=\"auto\">PWA \u8d4b\u4e88\u4e86\u6211\u4eec\u521b\u5efa\u540c\u65f6\u62e5\u6709\u4ee5\u4e0a\u4e24\u79cd\u4f18\u52bf\u7684\u5e94\u7528\u7684\u80fd\u529b\u3002<\/p>\n<\/blockquote>\n<h2 dir=\"auto\">\u4f53\u9a8c<\/h2>\n<p dir=\"auto\">\u5982\u679c\u4f60\u4e4b\u524d\u6ca1\u6709\u4e86\u89e3\u8fc7 PWA\uff0c\u5927\u6982\u7387\u53ef\u80fd\u4e5f\u4e0d\u660e\u767d\u8fd9\u662f\u4e2a\u4ec0\u4e48\u6548\u679c\uff0c\u6ca1\u6709\u5173\u7cfb\uff0c\u6211\u4eec\u76f4\u63a5\u770b\u4e00\u4e2a PWA \u5e94\u7528\u793a\u4f8b\uff0c\u6211\u4eec\u6253\u5f00 <a href=\"https:\/\/m.weibo.cn\/\" rel=\"nofollow\">https:\/\/m.weibo.cn\/<\/a>\uff0c\u8fd9\u91cc\u662f\u5728\u7535\u8111\u7aef\u6253\u5f00\u7684\uff1a<\/p>\n<p dir=\"auto\"><a target=\"_blank\" rel=\"noopener noreferrer nofollow\" href=\"\/\/www.lccc.top\/wp-content\/uploads\/pic\/mqyqingfen\/ce09d092334477be14e064a543aa95bd151ca9ac.jpg\"><img decoding=\"async\" src=\"\/\/www.lccc.top\/wp-content\/uploads\/pic\/mqyqingfen\/ce09d092334477be14e064a543aa95bd151ca9ac.jpg\" alt=\"\" data-canonical-src=\"https:\/\/p3-juejin.byteimg.com\/tos-cn-i-k3u1fbpfcp\/ed036902028846b98435ffe463ebab1f~tplv-k3u1fbpfcp-zoom-1.image\" style=\"max-width: 100%;\"><\/a><\/p>\n<p dir=\"auto\">\u6211\u4eec\u53ef\u4ee5\u770b\u5230\uff0c\u5728\u5730\u5740\u680f\u8fd8\u6709\u4e00\u4e2a\u5b89\u88c5\u56fe\u6807\uff0c\u70b9\u51fb\u4e00\u4e0b\uff0c\u5c31\u4f1a\u5f39\u51fa\u5b89\u88c5\u5e94\u7528\u7684\u9009\u9879\u6846\uff1a<\/p>\n<p dir=\"auto\"><a target=\"_blank\" rel=\"noopener noreferrer nofollow\" href=\"\/\/www.lccc.top\/wp-content\/uploads\/pic\/mqyqingfen\/ab021381e35e8f2cc53a86d7f08312cc2026a623.jpg\"><img decoding=\"async\" src=\"\/\/www.lccc.top\/wp-content\/uploads\/pic\/mqyqingfen\/ab021381e35e8f2cc53a86d7f08312cc2026a623.jpg\" alt=\"\" data-canonical-src=\"https:\/\/p3-juejin.byteimg.com\/tos-cn-i-k3u1fbpfcp\/4489ad5be12c458bb93c937f68852f64~tplv-k3u1fbpfcp-zoom-1.image\" style=\"max-width: 100%;\"><\/a><\/p>\n<p dir=\"auto\">\u6211\u4eec\u70b9\u51fb\u5b89\u88c5\u540e\uff0c\u8be5\u9875\u9762\u4f1a\u81ea\u52a8\u5173\u95ed\uff0c\u7136\u540e\u5f00\u542f\u4e00\u4e2a\u5e94\u7528\u7a97\u53e3\uff1a<\/p>\n<p dir=\"auto\"><a target=\"_blank\" rel=\"noopener noreferrer nofollow\" href=\"\/\/www.lccc.top\/wp-content\/uploads\/pic\/mqyqingfen\/e0e7f86938ad9a26c571f106e394aa8fbf2f0670.jpg\"><img decoding=\"async\" src=\"\/\/www.lccc.top\/wp-content\/uploads\/pic\/mqyqingfen\/e0e7f86938ad9a26c571f106e394aa8fbf2f0670.jpg\" alt=\"\" data-canonical-src=\"https:\/\/p3-juejin.byteimg.com\/tos-cn-i-k3u1fbpfcp\/d86d1e3f4b8a45199910442b635d3cf7~tplv-k3u1fbpfcp-zoom-1.image\" style=\"max-width: 100%;\"><\/a><\/p>\n<p dir=\"auto\">\u540c\u65f6\uff0c\u6253\u5f00 Mac \u7684\u542f\u52a8\u53f0\uff0c\u6211\u4eec\u4f1a\u770b\u5230\u5df2\u7ecf\u6dfb\u52a0\u4e86\u5fae\u535a\u7684\u56fe\u6807\uff1a<\/p>\n<p dir=\"auto\"><a target=\"_blank\" rel=\"noopener noreferrer nofollow\" href=\"\/\/www.lccc.top\/wp-content\/uploads\/pic\/mqyqingfen\/bda59db79c0d464f2f9df01d3f74f444eaa26c30.jpg\"><img decoding=\"async\" src=\"\/\/www.lccc.top\/wp-content\/uploads\/pic\/mqyqingfen\/bda59db79c0d464f2f9df01d3f74f444eaa26c30.jpg\" alt=\"\" data-canonical-src=\"https:\/\/p3-juejin.byteimg.com\/tos-cn-i-k3u1fbpfcp\/6c1dafe8ad5042dfb293bcdbc5e97492~tplv-k3u1fbpfcp-zoom-1.image\" style=\"max-width: 100%;\"><\/a><\/p>\n<p dir=\"auto\">\u70b9\u51fb\u5c31\u4f1a\u76f4\u63a5\u6253\u5f00\u4e0a\u9762\u7684\u5e94\u7528\u7a97\u53e3\u3002<\/p>\n<p dir=\"auto\">\u7b80\u5355\u7684\u6765\u8bf4\uff0c\u6211\u4eec\u517c\u5bb9 PWA\uff0c\u5c31\u662f\u60f3\u8981\u5b9e\u73b0\u8fd9\u6837\u7684\u684c\u9762\u56fe\u6807\u7684\u529f\u80fd\uff0c\u5f53\u7136\u4e86\uff0c PWA \u5176\u4ed6\u8fd8\u6709\u79bb\u7ebf\u7f13\u5b58\u3001\u63a8\u9001\u901a\u77e5\u7b49\u529f\u80fd\uff0c\u8fd9\u91cc\u5c31\u4e0d\u591a\u8bf4\u4e86\u3002<\/p>\n<h2 dir=\"auto\">\u5f00\u542f PWA<\/h2>\n<p dir=\"auto\">\u5f00\u542f PWA\uff0c\u9700\u8981\u6ce8\u610f\u4e09\u4e2a\u70b9\uff1a<\/p>\n<ol dir=\"auto\">\n<li>\u63d0\u4f9b\u4e00\u4e2a manifest.json \u6587\u4ef6\uff0c\u63cf\u8ff0\u5e94\u7528\u7684\u540d\u79f0\u3001\u56fe\u6807\u7b49\u4fe1\u606f<\/li>\n<li>\u5f00\u542f Service Worker\uff0c\u8fd9\u4e2a\u4ea4\u7ed9\u73b0\u6709\u7684 PWA \u63d2\u4ef6\u6765\u5b9e\u73b0<\/li>\n<li>\u5f00\u542f HTTPS<\/li>\n<\/ol>\n<h2 dir=\"auto\">\u5b9e\u8df5<\/h2>\n<h2 dir=\"auto\">1. \u5b89\u88c5<\/h2>\n<p dir=\"auto\">\u63d2\u4ef6\u5730\u5740\uff1a<a href=\"https:\/\/v1.vuepress.vuejs.org\/zh\/plugin\/official\/plugin-pwa.html#%E5%AE%89%E8%A3%85\" rel=\"nofollow\">https:\/\/v1.vuepress.vuejs.org\/zh\/plugin\/official\/plugin-pwa.html<\/a><\/p>\n<div class=\"highlight highlight-source-shell notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"yarn add -D @vuepress\/plugin-pwa\n# OR npm install -D @vuepress\/plugin-pwa\"><\/p>\n<pre class=\"notranslate\">yarn add -D @vuepress\/plugin-pwa\n<span class=\"pl-c\"><span class=\"pl-c\">#<\/span> OR npm install -D @vuepress\/plugin-pwa<\/span><\/pre>\n<\/div>\n<h2 dir=\"auto\">2. \u4fee\u6539 config.js<\/h2>\n<div class=\"highlight highlight-source-js notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"module.exports = {\n  head: [\n    ['link', { rel: 'icon', href: '\/logo.png' }],\n    ['link', { rel: 'manifest', href: '\/manifest.json' }],\n    ['meta', { name: 'theme-color', content: '#3eaf7c' }],\n    ['meta', { name: 'apple-mobile-web-app-capable', content: 'yes' }],\n    ['meta', { name: 'apple-mobile-web-app-status-bar-style', content: 'black' }],\n    ['link', { rel: 'apple-touch-icon', href: '\/icons\/apple-touch-icon-152x152.png' }],\n    ['link', { rel: 'mask-icon', href: '\/icons\/safari-pinned-tab.svg', color: '#3eaf7c' }],\n    ['meta', { name: 'msapplication-TileImage', content: '\/icons\/msapplication-icon-144x144.png' }],\n    ['meta', { name: 'msapplication-TileColor', content: '#000000' }]\n  ],\n  plugins: [\n    [\n      '@vuepress\/pwa',\n      {\n        serviceWorker: true,\n        updatePopup: {\n            message: &quot;\u53d1\u73b0\u65b0\u5185\u5bb9\u53ef\u7528&quot;,\n            buttonText: &quot;\u5237\u65b0&quot;\n        }\n     }\n    ]\n  ]\n}\"><\/p>\n<pre class=\"notranslate\"><span class=\"pl-smi\">module<\/span><span class=\"pl-kos\">.<\/span><span class=\"pl-c1\">exports<\/span> <span class=\"pl-c1\">=<\/span> <span class=\"pl-kos\">{<\/span>\n  <span class=\"pl-c1\">head<\/span>: <span class=\"pl-kos\">[<\/span>\n    <span class=\"pl-kos\">[<\/span><span class=\"pl-s\">'link'<\/span><span class=\"pl-kos\">,<\/span> <span class=\"pl-kos\">{<\/span> <span class=\"pl-c1\">rel<\/span>: <span class=\"pl-s\">'icon'<\/span><span class=\"pl-kos\">,<\/span> <span class=\"pl-c1\">href<\/span>: <span class=\"pl-s\">'\/logo.png'<\/span> <span class=\"pl-kos\">}<\/span><span class=\"pl-kos\">]<\/span><span class=\"pl-kos\">,<\/span>\n    <span class=\"pl-kos\">[<\/span><span class=\"pl-s\">'link'<\/span><span class=\"pl-kos\">,<\/span> <span class=\"pl-kos\">{<\/span> <span class=\"pl-c1\">rel<\/span>: <span class=\"pl-s\">'manifest'<\/span><span class=\"pl-kos\">,<\/span> <span class=\"pl-c1\">href<\/span>: <span class=\"pl-s\">'\/manifest.json'<\/span> <span class=\"pl-kos\">}<\/span><span class=\"pl-kos\">]<\/span><span class=\"pl-kos\">,<\/span>\n    <span class=\"pl-kos\">[<\/span><span class=\"pl-s\">'meta'<\/span><span class=\"pl-kos\">,<\/span> <span class=\"pl-kos\">{<\/span> <span class=\"pl-c1\">name<\/span>: <span class=\"pl-s\">'theme-color'<\/span><span class=\"pl-kos\">,<\/span> <span class=\"pl-c1\">content<\/span>: <span class=\"pl-s\">'#3eaf7c'<\/span> <span class=\"pl-kos\">}<\/span><span class=\"pl-kos\">]<\/span><span class=\"pl-kos\">,<\/span>\n    <span class=\"pl-kos\">[<\/span><span class=\"pl-s\">'meta'<\/span><span class=\"pl-kos\">,<\/span> <span class=\"pl-kos\">{<\/span> <span class=\"pl-c1\">name<\/span>: <span class=\"pl-s\">'apple-mobile-web-app-capable'<\/span><span class=\"pl-kos\">,<\/span> <span class=\"pl-c1\">content<\/span>: <span class=\"pl-s\">'yes'<\/span> <span class=\"pl-kos\">}<\/span><span class=\"pl-kos\">]<\/span><span class=\"pl-kos\">,<\/span>\n    <span class=\"pl-kos\">[<\/span><span class=\"pl-s\">'meta'<\/span><span class=\"pl-kos\">,<\/span> <span class=\"pl-kos\">{<\/span> <span class=\"pl-c1\">name<\/span>: <span class=\"pl-s\">'apple-mobile-web-app-status-bar-style'<\/span><span class=\"pl-kos\">,<\/span> <span class=\"pl-c1\">content<\/span>: <span class=\"pl-s\">'black'<\/span> <span class=\"pl-kos\">}<\/span><span class=\"pl-kos\">]<\/span><span class=\"pl-kos\">,<\/span>\n    <span class=\"pl-kos\">[<\/span><span class=\"pl-s\">'link'<\/span><span class=\"pl-kos\">,<\/span> <span class=\"pl-kos\">{<\/span> <span class=\"pl-c1\">rel<\/span>: <span class=\"pl-s\">'apple-touch-icon'<\/span><span class=\"pl-kos\">,<\/span> <span class=\"pl-c1\">href<\/span>: <span class=\"pl-s\">'\/icons\/apple-touch-icon-152x152.png'<\/span> <span class=\"pl-kos\">}<\/span><span class=\"pl-kos\">]<\/span><span class=\"pl-kos\">,<\/span>\n    <span class=\"pl-kos\">[<\/span><span class=\"pl-s\">'link'<\/span><span class=\"pl-kos\">,<\/span> <span class=\"pl-kos\">{<\/span> <span class=\"pl-c1\">rel<\/span>: <span class=\"pl-s\">'mask-icon'<\/span><span class=\"pl-kos\">,<\/span> <span class=\"pl-c1\">href<\/span>: <span class=\"pl-s\">'\/icons\/safari-pinned-tab.svg'<\/span><span class=\"pl-kos\">,<\/span> <span class=\"pl-c1\">color<\/span>: <span class=\"pl-s\">'#3eaf7c'<\/span> <span class=\"pl-kos\">}<\/span><span class=\"pl-kos\">]<\/span><span class=\"pl-kos\">,<\/span>\n    <span class=\"pl-kos\">[<\/span><span class=\"pl-s\">'meta'<\/span><span class=\"pl-kos\">,<\/span> <span class=\"pl-kos\">{<\/span> <span class=\"pl-c1\">name<\/span>: <span class=\"pl-s\">'msapplication-TileImage'<\/span><span class=\"pl-kos\">,<\/span> <span class=\"pl-c1\">content<\/span>: <span class=\"pl-s\">'\/icons\/msapplication-icon-144x144.png'<\/span> <span class=\"pl-kos\">}<\/span><span class=\"pl-kos\">]<\/span><span class=\"pl-kos\">,<\/span>\n    <span class=\"pl-kos\">[<\/span><span class=\"pl-s\">'meta'<\/span><span class=\"pl-kos\">,<\/span> <span class=\"pl-kos\">{<\/span> <span class=\"pl-c1\">name<\/span>: <span class=\"pl-s\">'msapplication-TileColor'<\/span><span class=\"pl-kos\">,<\/span> <span class=\"pl-c1\">content<\/span>: <span class=\"pl-s\">'#000000'<\/span> <span class=\"pl-kos\">}<\/span><span class=\"pl-kos\">]<\/span>\n  <span class=\"pl-kos\">]<\/span><span class=\"pl-kos\">,<\/span>\n  <span class=\"pl-c1\">plugins<\/span>: <span class=\"pl-kos\">[<\/span>\n    <span class=\"pl-kos\">[<\/span>\n      <span class=\"pl-s\">'@vuepress\/pwa'<\/span><span class=\"pl-kos\">,<\/span>\n      <span class=\"pl-kos\">{<\/span>\n        <span class=\"pl-c1\">serviceWorker<\/span>: <span class=\"pl-c1\">true<\/span><span class=\"pl-kos\">,<\/span>\n        <span class=\"pl-c1\">updatePopup<\/span>: <span class=\"pl-kos\">{<\/span>\n            <span class=\"pl-c1\">message<\/span>: <span class=\"pl-s\">\"\u53d1\u73b0\u65b0\u5185\u5bb9\u53ef\u7528\"<\/span><span class=\"pl-kos\">,<\/span>\n            <span class=\"pl-c1\">buttonText<\/span>: <span class=\"pl-s\">\"\u5237\u65b0\"<\/span>\n        <span class=\"pl-kos\">}<\/span>\n     <span class=\"pl-kos\">}<\/span>\n    <span class=\"pl-kos\">]<\/span>\n  <span class=\"pl-kos\">]<\/span>\n<span class=\"pl-kos\">}<\/span><\/pre>\n<\/div>\n<h2 dir=\"auto\">3. \u6dfb\u52a0 manifest.json \u7b49\u8d44\u6e90<\/h2>\n<p dir=\"auto\">\u63a5\u4e0b\u6765\u6211\u4eec\u6dfb\u52a0\u6240\u9700\u8981\u7684\u8d44\u6e90\uff0c\u5728 <code class=\"notranslate\">.vuepress<\/code>\u76ee\u5f55\u4e0b\u5efa\u7acb <code class=\"notranslate\">public<\/code>\u6587\u4ef6\u5939\uff0c\u7136\u540e\u6dfb\u52a0\u6240\u9700\u8981\u7684\u6587\u4ef6\u5982 <code class=\"notranslate\">manifest.json<\/code>\u6587\u4ef6\uff1a<\/p>\n<div class=\"highlight highlight-source-json notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content='{\n    \"name\": \"TypeScript\u4e2d\u6587\u6587\u6863\",\n    \"short_name\": \"TypeScriptDocs\",\n    \"display\": \"standalone\",\n    \"background_color\": \"#fff\",\n    \"start_url\": \"\/learn-typescript-test\/\",\n    \"scope\": \"\/learn-typescript-test\/\",\n    \"description\": \"TypeScript \u4e2d\u6587\u6587\u6863 \u8fdb\u9636\u6559\u7a0b\",\n    \"icons\": [{\n      \"src\": \"logo52.png\",\n      \"sizes\": \"52x52\",\n      \"type\": \"image\/png\"\n    },{\n       \"src\": \"logo288.png\",\n       \"sizes\": \"288x288\",\n       \"type\": \"image\/png\"\n    }]\n  }'><\/p>\n<pre class=\"notranslate\">{\n    <span class=\"pl-ent\">\"name\"<\/span>: <span class=\"pl-s\"><span class=\"pl-pds\">\"<\/span>TypeScript\u4e2d\u6587\u6587\u6863<span class=\"pl-pds\">\"<\/span><\/span>,\n    <span class=\"pl-ent\">\"short_name\"<\/span>: <span class=\"pl-s\"><span class=\"pl-pds\">\"<\/span>TypeScriptDocs<span class=\"pl-pds\">\"<\/span><\/span>,\n    <span class=\"pl-ent\">\"display\"<\/span>: <span class=\"pl-s\"><span class=\"pl-pds\">\"<\/span>standalone<span class=\"pl-pds\">\"<\/span><\/span>,\n    <span class=\"pl-ent\">\"background_color\"<\/span>: <span class=\"pl-s\"><span class=\"pl-pds\">\"<\/span>#fff<span class=\"pl-pds\">\"<\/span><\/span>,\n    <span class=\"pl-ent\">\"start_url\"<\/span>: <span class=\"pl-s\"><span class=\"pl-pds\">\"<\/span>\/learn-typescript-test\/<span class=\"pl-pds\">\"<\/span><\/span>,\n    <span class=\"pl-ent\">\"scope\"<\/span>: <span class=\"pl-s\"><span class=\"pl-pds\">\"<\/span>\/learn-typescript-test\/<span class=\"pl-pds\">\"<\/span><\/span>,\n    <span class=\"pl-ent\">\"description\"<\/span>: <span class=\"pl-s\"><span class=\"pl-pds\">\"<\/span>TypeScript \u4e2d\u6587\u6587\u6863 \u8fdb\u9636\u6559\u7a0b<span class=\"pl-pds\">\"<\/span><\/span>,\n    <span class=\"pl-ent\">\"icons\"<\/span>: [{\n      <span class=\"pl-ent\">\"src\"<\/span>: <span class=\"pl-s\"><span class=\"pl-pds\">\"<\/span>logo52.png<span class=\"pl-pds\">\"<\/span><\/span>,\n      <span class=\"pl-ent\">\"sizes\"<\/span>: <span class=\"pl-s\"><span class=\"pl-pds\">\"<\/span>52x52<span class=\"pl-pds\">\"<\/span><\/span>,\n      <span class=\"pl-ent\">\"type\"<\/span>: <span class=\"pl-s\"><span class=\"pl-pds\">\"<\/span>image\/png<span class=\"pl-pds\">\"<\/span><\/span>\n    },{\n       <span class=\"pl-ent\">\"src\"<\/span>: <span class=\"pl-s\"><span class=\"pl-pds\">\"<\/span>logo288.png<span class=\"pl-pds\">\"<\/span><\/span>,\n       <span class=\"pl-ent\">\"sizes\"<\/span>: <span class=\"pl-s\"><span class=\"pl-pds\">\"<\/span>288x288<span class=\"pl-pds\">\"<\/span><\/span>,\n       <span class=\"pl-ent\">\"type\"<\/span>: <span class=\"pl-s\"><span class=\"pl-pds\">\"<\/span>image\/png<span class=\"pl-pds\">\"<\/span><\/span>\n    }]\n  }<\/pre>\n<\/div>\n<p dir=\"auto\">\u8fd9\u5176\u4e2d\u5b57\u6bb5\u7684\u5177\u4f53\u542b\u4e49\uff0c\u53ef\u4ee5\u67e5\u770b MDN \u7684 <a href=\"https:\/\/developer.mozilla.org\/zh-CN\/docs\/Web\/Manifest\" rel=\"nofollow\">Manifest \u4ecb\u7ecd<\/a>\u3002<\/p>\n<p dir=\"auto\">\u8981\u6ce8\u610f\u5176\u4e2d\u7684 <code class=\"notranslate\">start_url<\/code>\u548c<code class=\"notranslate\">scope<\/code>\uff0c\u5982\u679c\u4f60\u4f7f\u7528\u7684\u662f GitHub \u6216\u8005 Gitee \u4ed3\u5e93\u7684 Pages \u670d\u52a1\uff0c\u5e76\u4e14\u5730\u5740\u4e0a\u5e26\u4e86\u4ed3\u5e93\u540d\uff0c\u4f60\u9700\u8981\u5c06\u8fd9\u91cc\u7684<code class=\"notranslate\">learn-typescript-test<\/code>\u66ff\u6362\u4e3a\u4f60\u7684\u4ed3\u5e93\u540d\uff0c\u5982\u679c\u662f\u76f4\u63a5\u7684\u57df\u540d\uff0cstart_url \u5199\u6210  <code class=\"notranslate\">\\<\/code>\uff0c<code class=\"notranslate\">scope<\/code>\u5199\u6210 <code class=\"notranslate\">.<\/code>\u6216\u8005\u76f4\u63a5\u4e0d\u5199\u3002<\/p>\n<p dir=\"auto\">\u7136\u540e\u662f\u8865\u9f50\u6240\u9700\u8981\u7684\u56fe\u6807\u56fe\u7247\uff1a<\/p>\n<p dir=\"auto\"><a target=\"_blank\" rel=\"noopener noreferrer nofollow\" href=\"\/\/www.lccc.top\/wp-content\/uploads\/pic\/mqyqingfen\/07929bd24a21720c1c338c0e6ceed0604f2361ed.jpg\"><img decoding=\"async\" src=\"\/\/www.lccc.top\/wp-content\/uploads\/pic\/mqyqingfen\/07929bd24a21720c1c338c0e6ceed0604f2361ed.jpg\" alt=\"\" data-canonical-src=\"https:\/\/p3-juejin.byteimg.com\/tos-cn-i-k3u1fbpfcp\/d18f572e116e4c6c9e9b4690f65ee8ba~tplv-k3u1fbpfcp-zoom-1.image\" style=\"max-width: 100%;\"><\/a><\/p>\n<h2 dir=\"auto\">4. \u90e8\u7f72\u751f\u4ea7\u73af\u5883\u6d4b\u8bd5<\/h2>\n<p dir=\"auto\">\u867d\u7136\u6211\u4eec\u5728\u4e0a\u7bc7<a href=\"https:\/\/github.com\/mqyqingfeng\/Blog\/issues\/262\" data-hovercard-type=\"issue\" data-hovercard-url=\"\/mqyqingfeng\/Blog\/issues\/262\/hovercard\">\u300aVuePress \u535a\u5ba2\u5982\u4f55\u5f00\u542f\u672c\u5730 HTTPS \u8bbf\u95ee\u300b<\/a> \u8bb2\u4e86\u5982\u4f55\u5728\u672c\u5730\u5f00\u542f HTTPS\uff0c\u4f46\u662f\u56e0\u4e3a\u6211\u4eec\u4f7f\u7528\u7684\u8fd9\u4e2a<a href=\"https:\/\/v1.vuepress.vuejs.org\/zh\/plugin\/official\/plugin-pwa.html#%E9%80%89%E9%A1%B9\" rel=\"nofollow\">\u63d2\u4ef6<\/a>\u53ea\u6709\u5728\u751f\u4ea7\u73af\u5883\u624d\u4f1a\u5f00\u542f Service Worker\uff1a<\/p>\n<p dir=\"auto\"><a target=\"_blank\" rel=\"noopener noreferrer nofollow\" href=\"\/\/www.lccc.top\/wp-content\/uploads\/pic\/mqyqingfen\/cfdaef75ab699f23bf54784e5b403a2b4bdcc1b9.jpg\"><img decoding=\"async\" src=\"\/\/www.lccc.top\/wp-content\/uploads\/pic\/mqyqingfen\/cfdaef75ab699f23bf54784e5b403a2b4bdcc1b9.jpg\" alt=\"\" data-canonical-src=\"https:\/\/p3-juejin.byteimg.com\/tos-cn-i-k3u1fbpfcp\/ec26284b10724d85aecb141eb509b676~tplv-k3u1fbpfcp-zoom-1.image\" style=\"max-width: 100%;\"><\/a><\/p>\n<p dir=\"auto\">\u6240\u4ee5\u5462\uff0c\u6211\u4eec\u90e8\u7f72\u5230\u7ebf\u4e0a\u770b\u4e00\u4e0b\u6548\u679c\uff0c\u5982\u679c\u987a\u5229\u7684\u8bdd\uff0c\u4f60\u5c31\u4f1a\u770b\u5230\u5730\u5740\u680f\u4e0a\u4e5f\u51fa\u73b0\u4e86\u5b89\u88c5\u56fe\u6807\uff1a<\/p>\n<p dir=\"auto\"><a target=\"_blank\" rel=\"noopener noreferrer nofollow\" href=\"\/\/www.lccc.top\/wp-content\/uploads\/pic\/mqyqingfen\/0a432a554b10fd56cfb86891e6d5f198f1ab0afd.jpg\"><img decoding=\"async\" src=\"\/\/www.lccc.top\/wp-content\/uploads\/pic\/mqyqingfen\/0a432a554b10fd56cfb86891e6d5f198f1ab0afd.jpg\" alt=\"\" data-canonical-src=\"https:\/\/p3-juejin.byteimg.com\/tos-cn-i-k3u1fbpfcp\/e999f83f22e8481bbb110a7f36ac83d4~tplv-k3u1fbpfcp-zoom-1.image\" style=\"max-width: 100%;\"><\/a><\/p>\n<h2 dir=\"auto\">\u5e38\u89c1\u95ee\u9898<\/h2>\n<p dir=\"auto\">\u4f46\u5982\u679c\u6ca1\u6709\u663e\u793a\u8be5\u56fe\u6807\uff0c\u6211\u4eec\u53ef\u4ee5\u67e5\u770b\u5f00\u53d1\u8005\u5de5\u5177\u91cc\u7684\u300c\u5e94\u7528\u300d -\u300c\u6e05\u5355\u300d\uff0c\u5176\u4e2d\u4f1a\u663e\u793a\u51fa\u73b0\u7684\u9519\u8bef\uff1a<\/p>\n<p dir=\"auto\"><a target=\"_blank\" rel=\"noopener noreferrer nofollow\" href=\"\/\/www.lccc.top\/wp-content\/uploads\/pic\/mqyqingfen\/3b507d99e289dc3b57559f0a05049ef5f53c1eac.jpg\"><img decoding=\"async\" src=\"\/\/www.lccc.top\/wp-content\/uploads\/pic\/mqyqingfen\/3b507d99e289dc3b57559f0a05049ef5f53c1eac.jpg\" alt=\"\" data-canonical-src=\"https:\/\/p3-juejin.byteimg.com\/tos-cn-i-k3u1fbpfcp\/924956b606894c31b058b66bf335b8c2~tplv-k3u1fbpfcp-zoom-1.image\" style=\"max-width: 100%;\"><\/a><\/p>\n<p dir=\"auto\">\u6839\u636e\u8fd9\u91cc\u7684\u62a5\u9519\u8fdb\u884c\u6392\u67e5\u3002<\/p>\n<p dir=\"auto\">\u5982\u679c\u51fa\u73b0\u4e86\u53ef\u5b89\u88c5\u6027\u4e2d\u7684\uff1a<\/p>\n<blockquote>\n<p dir=\"auto\">\u4e3a\u68c0\u6d4b\u5230\u4efb\u4f55\u5339\u914d\u7684 service worker\u3002\u60a8\u53ef\u80fd\u9700\u8981\u91cd\u65b0\u52a0\u8f7d\u9875\u9762\uff0c\u6216\u8005\u68c0\u67e5\u5f53\u524d\u9875\u9762\u7684 service worker \u662f\u5426\u4e5f\u63a7\u5236\u4e86\u6e05\u5355\u9519\u8bef\u4e2d\u7684\u8d77\u59cb URL\u3002<\/p>\n<\/blockquote>\n<p dir=\"auto\">\u8fd9\u4e5f\u6709\u53ef\u80fd\u662f\u56e0\u4e3a\u4f60\u7684 <code class=\"notranslate\">start_url<\/code> \u548c <code class=\"notranslate\">scope<\/code> \u8bbe\u7f6e\u7684\u6709\u95ee\u9898\u3002<\/p>\n<p dir=\"auto\">\u6b63\u5e38\u5b89\u88c5\u540e\uff0c\u5982\u679c\u6253\u5f00\u5e94\u7528\u53d1\u73b0\u80cc\u666f\u8272\u662f Vue \u7eff\u8272\uff0c\u6bd4\u5982\u8fd9\u79cd\uff1a<\/p>\n<p dir=\"auto\"><a target=\"_blank\" rel=\"noopener noreferrer nofollow\" href=\"\/\/www.lccc.top\/wp-content\/uploads\/pic\/mqyqingfen\/064cdba2278658fcf82d50a293009f1f2b2c5164.jpg\"><img decoding=\"async\" src=\"\/\/www.lccc.top\/wp-content\/uploads\/pic\/mqyqingfen\/064cdba2278658fcf82d50a293009f1f2b2c5164.jpg\" alt=\"\" data-canonical-src=\"https:\/\/p3-juejin.byteimg.com\/tos-cn-i-k3u1fbpfcp\/eb3211dd76704ba6961c911eb80c9851~tplv-k3u1fbpfcp-zoom-1.image\" style=\"max-width: 100%;\"><\/a><\/p>\n<p dir=\"auto\">\u8fd9\u662f\u56e0\u4e3a\u4f60\u5fd8\u8bb0\u4fee\u6539 config.js \u91cc\u7684\u80cc\u666f\u8272\u4e86\uff1a<\/p>\n<p dir=\"auto\"><a target=\"_blank\" rel=\"noopener noreferrer nofollow\" href=\"\/\/www.lccc.top\/wp-content\/uploads\/pic\/mqyqingfen\/667c5a59a3957b048325efe86fb7f1cbe5fc2a1c.jpg\"><img decoding=\"async\" src=\"\/\/www.lccc.top\/wp-content\/uploads\/pic\/mqyqingfen\/667c5a59a3957b048325efe86fb7f1cbe5fc2a1c.jpg\" alt=\"\" data-canonical-src=\"https:\/\/p3-juejin.byteimg.com\/tos-cn-i-k3u1fbpfcp\/38d9ec108ae74f50b3bba7f9029cb4b2~tplv-k3u1fbpfcp-zoom-1.image\" style=\"max-width: 100%;\"><\/a><\/p>\n<h2 dir=\"auto\">\u7cfb\u5217\u6587\u7ae0<\/h2>\n<p dir=\"auto\">\u535a\u5ba2\u642d\u5efa\u7cfb\u5217\u662f\u6211\u81f3\u4eca\u5199\u7684\u552f\u4e00\u4e00\u4e2a\u504f\u5b9e\u6218\u7684\u7cfb\u5217\u6559\u7a0b\uff0c\u9884\u8ba1 20 \u7bc7\u5de6\u53f3\uff0c\u8bb2\u89e3\u5982\u4f55\u4f7f\u7528 VuePress \u642d\u5efa\u3001\u4f18\u5316\u535a\u5ba2\uff0c\u5e76\u90e8\u7f72\u5230 GitHub\u3001Gitee\u3001\u79c1\u6709\u670d\u52a1\u5668\u7b49\u5e73\u53f0\u3002\u672c\u7bc7\u4e3a\u7b2c 23 \u7bc7\uff0c\u5168\u7cfb\u5217\u6587\u7ae0\u5730\u5740\uff1a<a href=\"https:\/\/github.com\/mqyqingfeng\/Blog\">https:\/\/github.com\/mqyqingfeng\/Blog<\/a><\/p>\n<p dir=\"auto\">\u5fae\u4fe1\uff1a\u300cmqyqingfeng\u300d\uff0c\u52a0\u6211\u8fdb\u51b4\u7fbd\u552f\u4e00\u7684\u8bfb\u8005\u7fa4\u3002<\/p>\n<\/td>\n<p>\u6587\u7ae0\u8f6c\u8f7d\u81ea<a href='https:\/\/github.com\/mqyqingfeng\/Blog\/issues\/263'>https:\/\/github.com\/mqyqingfeng\/Blog\/issues\/263<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u524d\u8a00 \u5728 \u300a\u4e00\u7bc7\u5e26\u4f60\u7528 VuePress + Github Pages \u642d\u5efa\u535a\u5ba2\u300b\u4e2d\uff0c\u6211\u4eec\u4f7f\u7528 VuePress \u642d\u5efa\u4e86\u4e00\u4e2a\u535a\u5ba2\uff0c\u6700\u7ec8\u7684\u6548\u679c\u67e5\u770b\uff1aTypeScr&#8230;<\/p>\n<p class=\"read-more\"><a class=\"btn btn-default\" href=\"https:\/\/www.lccc.top\/?p=1399\"> Read More<span class=\"screen-reader-text\">  Read More<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1399","post","type-post","status-publish","format-standard","hentry","category-learn"],"_links":{"self":[{"href":"https:\/\/www.lccc.top\/index.php?rest_route=\/wp\/v2\/posts\/1399"}],"collection":[{"href":"https:\/\/www.lccc.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.lccc.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.lccc.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.lccc.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1399"}],"version-history":[{"count":1,"href":"https:\/\/www.lccc.top\/index.php?rest_route=\/wp\/v2\/posts\/1399\/revisions"}],"predecessor-version":[{"id":1482,"href":"https:\/\/www.lccc.top\/index.php?rest_route=\/wp\/v2\/posts\/1399\/revisions\/1482"}],"wp:attachment":[{"href":"https:\/\/www.lccc.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1399"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.lccc.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1399"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.lccc.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1399"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}