{"id":3241,"date":"2021-04-25T08:46:43","date_gmt":"2021-04-25T00:46:43","guid":{"rendered":"http:\/\/www.yuguoxy.com\/geekhome\/?p=3241"},"modified":"2026-08-18T12:35:34","modified_gmt":"2026-08-18T04:35:34","slug":"%e7%94%9f%e6%88%90%e5%89%8d%e7%ab%af%e6%b5%b7%e6%8a%a5%e7%9a%84-n-%e7%a7%8d%e6%96%b9%e6%a1%88%e5%92%8c%e4%bc%98%e5%8a%a3","status":"publish","type":"post","link":"https:\/\/ai.zhousir.top\/?p=3241","title":{"rendered":"\u751f\u6210\u524d\u7aef\u6d77\u62a5\u7684 N \u79cd\u65b9\u6848\u548c\u4f18\u52a3"},"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;\">\u4e1a\u52a1\u91cc\u7ecf\u5e38\u8981<strong style=\"color: #4870ac;\">\u751f\u6210\u5206\u4eab\u6d77\u62a5<\/strong>\uff1aPC \u5206\u4eab\u56fe\u3001H5 \u4f18\u60e0\u5238\u3001\u5e74\u5ea6\u8d26\u5355\u3002\u9700\u6c42\u4e0d\u540c\uff0c\u65b9\u6848\u4e5f\u4e0d\u540c\u2014\u2014\u7b2c\u4e09\u65b9\u5e93\u3001\u81ea\u5df1\u7528 Canvas \u753b\u3001\u4e22\u7ed9\u63a5\u53e3\u3002\u5404\u81ea\u90fd\u8e29\u8fc7\u8de8\u57df\u3001\u5b57\u4f53\u3001\u6e05\u6670\u5ea6\u3002<\/p>\n<p style=\"margin: 1em 0px;\">\u4e0b\u9762\u6309 html2canvas\u3001dom-to-image\u3001\u524d\u7aef Canvas\u3001\u63a5\u53e3\u51fa\u56fe\u6574\u7406\u517c\u5bb9\u6027\u548c\u53d6\u820d\u3002\u8fc7\u7a0b\u4e2d\u7684\u5751\uff08\u8de8\u57df\u3001\u6587\u5b57\u3001\u4f2a\u7c7b\uff09\u5c3d\u91cf\u5199\u5168\uff0c\u65b9\u4fbf\u5bf9\u7167\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;\">\u4e00\u3001\u80cc\u666f\u4e0e\u4e1a\u52a1<\/h2>\n<p style=\"margin: 1em 0px;\">PC \u4fa7\u4e3b\u8981\u662f\u5206\u4eab\u6d77\u62a5\uff1bH5 \u8fd8\u6709\u5206\u4eab\u4f18\u60e0\u5238\u3001\u5e74\u5ea6\u8d26\u5355\u3001\u5206\u4eab\u6d77\u62a5\u3002\u5b9e\u73b0\u65f6\u517c\u5bb9\u6027\u3001\u8fd8\u539f\u5ea6\u3001\u6027\u80fd\u8981\u4e00\u8d77\u6743\u8861\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\u3001html2canvas<\/h2>\n<p style=\"margin: 1em 0px;\">\u7248\u672c 1.0.0-rc7\u3002\u4ed3\u5e93 <a class=\"url\" href=\"https:\/\/github.com\/niklasvh\/h\" target=\"_blank\">https:\/\/github.com\/niklasvh\/h<\/a>&#8230;\u3000star \u7ea6 22k\uff08\u7edf\u8ba1\u4e8e 2021-01-06\uff09\u3002\u9996\u9875 demo\uff1a<a class=\"url\" href=\"https:\/\/html2canvas.hertzen.com\/\" target=\"_blank\">https:\/\/html2canvas.hertzen.com\/<\/a><\/p>\n<p style=\"margin: 1em 0px;\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-3243\" src=\"https:\/\/ai.zhousir.top\/wp-content\/uploads\/2021\/04\/20210425084503.png\" alt=\"20210425084503\" width=\"872\" height=\"353\" \/><\/p>\n<h3 style=\"padding: 0px; color: #4870ac; margin: 1.2em 0px 1em; font-size: 1.3em;\">\u517c\u5bb9\u6027\u62bd\u6d4b<\/h3>\n<ul style=\"padding-left: 1rem; margin-left: 1rem; font-size: 0.9rem; list-style-type: disc;\">\n<li>\n<section>\u5b89\u5353\uff1a6.0 koobee \u2705\uff1b5.0.2 vivo Y51A \u2705<\/section>\n<\/li>\n<li>\n<section>\u5b89\u5353\u5fae\u4fe1\u5185\u7f6e\uff1a7.0.3 \u2705\uff1b7.0.22 \u2705<\/section>\n<\/li>\n<li>\n<section>iOS\uff1a14.2 \u2705\uff1b11.2.1 \u2705<\/section>\n<\/li>\n<li>\n<section>iOS \u5fae\u4fe1\u5185\u7f6e\uff1a7.0.20 \u2705\uff1b7.0.1 \u2705<\/section>\n<\/li>\n<\/ul>\n<p style=\"margin: 1em 0px;\">\u5b98\u65b9\u5bf9\u6d4f\u89c8\u5668\u7684\u63cf\u8ff0\uff08\u9700 Promise polyfill\uff09\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;\">Browser compatibility\nThe library should work fine on the following browsers (with Promise polyfill):\n\nFirefox 3.5+\nGoogle Chrome\nOpera 12+\nIE9+\nSafari 6+\nAs each CSS property needs to be manually built to be supported, there are a number of properties that are not yet supported.<\/code><\/pre>\n<p style=\"margin: 1em 0px;\"><strong style=\"color: #4870ac;\">\u4f18\u70b9<\/strong>\uff1a\u517c\u5bb9\u9762\u66f4\u5bbd\u3002<strong style=\"color: #4870ac;\">\u7f3a\u70b9<\/strong>\uff1a\u4e0d\u5c11 CSS \u8f6c\u4e0d\u8fc7\u53bb\u2014\u2014\u4f2a\u7c7b\u3001border dash\u3001text-shadow \u90fd\u4e0d\u652f\u6301\u3002\u8fd8\u539f\u5ea6\u8981\u548c\u8bbe\u8ba1\u5bf9\u9f50\uff0c\u6216\u6539\u6210\u5207\u56fe\u3002\u7279\u6027\u8bf4\u660e\uff1a<a class=\"url\" href=\"https:\/\/html2canvas.hertzen.c\" target=\"_blank\">https:\/\/html2canvas.hertzen.c<\/a>&#8230;<\/p>\n<p style=\"margin: 1em 0px;\">rc5 \u5728 iOS \u4e0a\u51fa\u73b0\u8fc7\u751f\u6210\u4e0d\u4e86\u56fe\uff0c\u9000\u56de rc4 \u5c31\u597d\u3002<a class=\"url\" href=\"https:\/\/github.com\/niklasvh\/h\" target=\"_blank\">https:\/\/github.com\/niklasvh\/h<\/a>&#8230;\u3000issue \u91cc\u6709 iOS \u67d0\u7248\u672c\u5fae\u4fe1\u5931\u8d25\u7684\u53cd\u9988\uff0c\u5f53\u65f6\u6ca1\u590d\u73b0\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;\">\u4e09\u3001dom-to-image<\/h2>\n<p style=\"margin: 1em 0px;\">\u7248\u672c 2.6.0\u3002<a class=\"url\" href=\"https:\/\/github.com\/tsayen\/dom\" target=\"_blank\">https:\/\/github.com\/tsayen\/dom<\/a>&#8230;\u3000star \u7ea6 6.9k\u3002<\/p>\n<p style=\"margin: 1em 0px;\">\u4f18\u70b9\u662f\u5143\u7d20\u9f50\u3001\u8fd8\u539f\u5ea6\u9ad8\u3002\u7f3a\u70b9\u662f\u4e0d\u517c\u5bb9 Safari\uff0c\u5efa\u8bae\u53ea\u5728 Chrome \u7528\uff0c\u800c\u4e14\u5df2\u7ecf\u4e0d\u518d\u7ef4\u62a4\u3002<\/p>\n<p style=\"margin: 1em 0px;\">\u4f5c\u8005\u660e\u786e\u8bf4\u4e0d\u652f\u6301 Safari\uff0c\u539f\u56e0\u662f foreignObject \u7684\u5b89\u5168\u9650\u5236\uff1a<\/p>\n<ul style=\"padding-left: 1rem; margin-left: 1rem; font-size: 0.9rem; list-style-type: disc;\">\n<li>\n<section><a class=\"url\" href=\"https:\/\/github.com\/tsayen\/dom\" target=\"_blank\">https:\/\/github.com\/tsayen\/dom<\/a>&#8230;<\/section>\n<\/li>\n<li>\n<section><a class=\"url\" href=\"https:\/\/html.spec.whatwg.org\/\" target=\"_blank\">https:\/\/html.spec.whatwg.org\/<\/a>&#8230;<\/section>\n<\/li>\n<li>\n<section>SVG \u5728 Web \u653b\u51fb\u4e2d\u7684\u5e94\u7528\uff1a<a class=\"url\" href=\"https:\/\/www.anquanke.com\/post\" target=\"_blank\">https:\/\/www.anquanke.com\/post<\/a>&#8230;<\/section>\n<\/li>\n<\/ul>\n<p style=\"margin: 1em 0px;\">iOS 14.2 \u7b2c\u4e00\u6b21\u751f\u6210\u5e38\u5e38\u4e22\u56fe\uff0c\u7b2c\u4e8c\u6b21\u6216\u7b2c\u4e09\u6b21\u624d\u6b63\u5e38\u3002\u6743\u5b9c\u4e4b\u8ba1\u662f\u8fde\u8c03 2\uff5e3 \u6b21\u53d6\u6700\u540e\u4e00\u6b21\uff1bissue \u91cc\u4ecd\u6709\u673a\u578b\u4e0d\u884c\u3002\u4f4e\u7aef\u5b89\u5353\u4f1a\u5931\u8d25\uff0c\u591a\u534a\u662f\u6587\u5b57\u95ee\u9898\uff08\u65e7\u7b14\u8bb0\uff0c\u4e0d\u5b8c\u5168\u786e\u5b9a\uff09\uff1a<\/p>\n<p style=\"margin: 1em 0px;\"><a href=\"https:\/\/ai.zhousir.top\/wp-content\/uploads\/2021\/04\/20210425083933.png\" rel=\"fancybox\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-3245\" src=\"https:\/\/ai.zhousir.top\/wp-content\/uploads\/2021\/04\/20210425083933.png\" alt=\"20210425083933\" width=\"1044\" height=\"400\" \/><\/a><\/p>\n<p style=\"margin: 1em 0px;\">\u7528\u5728 PC \u6216 Android \u65f6\uff0c\u6e05\u6670\u5ea6\u4e0d\u5fc5\u6539\u6e90\u7801\uff0c\u4f5c\u8005\u63d0\u4f9b\u4e86\u53c2\u6570\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;\">\u6e05\u6670\u5ea6\u95ee\u9898\uff1a\u770b\u5230\u5f88\u591a\u4eba\u8bf4\u8981\u53bb\u6539\u6e90\u7801\uff0c\u5176\u5b9e\u4e0d\u7528\u7684\uff0c\u4f5c\u8005\u662f\u63d0\u4f9b\u4e86\u53c2\u6570\u4e86<\/code><\/pre>\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;\">\/\/ \u901a\u8fc7 scale \u653e\u5927\u8bbe\u5907\u7684 DPR \u500d\u6570\nlet elm = document.getElementById('my-node')\nconst scale = window.devicePixelRatio\nthis.loader.open()\nawait this.$nextTick()\ndomtoimage\n    .toBlob(elm, {\n         quantity: 1,\n         width: elm.offsetWidth * scale, \/\/ \u753b\u5e03\u653e\u5927\n         height: elm.offsetHeight * scale,\n        style: {\n            transform: `scale(${scale})`, \/\/ \u5143\u7d20\u653e\u5927\n            transformOrigin: '0 0',\n        },\n    })\n    .then(this.upload) \/\/ \u5904\u7406\u7ed3\u679c\n    .catch(function (error) {\n        this.loader.close()\n        console.error('oops, something went wrong!', error)\n    })<\/code><\/pre>\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\u524d\u7aef Canvas \u624b\u7ed8<\/h2>\n<h3 style=\"padding: 0px; color: #4870ac; margin: 1.2em 0px 1em; font-size: 1.3em;\">\u753b\u5e03\u4e0e\u56fe\u7247<\/h3>\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;\">let canvasBox = document.createElement('canvas')\nlet ctx = canvasBox.getContext(\n                    '2d'\n                ) as CanvasRenderingContext2D<\/code><\/pre>\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;\">let bgImag = ''\nctx.drawImage(bgImg, 0, 0)<\/code><\/pre>\n<p style=\"margin: 1em 0px;\">\u56fe\u7247\u8de8\u57df\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;\">\u89e3\u51b3\u529e\u6cd5 \uff1a\n1\uff09\u4f7f\u7528 crossOrigin \u5c5e\u6027\u3002\n\u89e3\u51b3 canvas \u56fe\u7247 getImageData\u3001toDataURL \u8de8\u57df\u95ee\u9898\n2\uff09\u56fe\u7247\u672c\u8eab\u4e5f\u9700\u8981\u5141\u8bb8\u8de8\u57df\n3\uff09\u8bbe\u7f6e useCORS\uff1atrue\uff0c\u539f\u7406\u76f8\u540c\uff0c\u4f46\u4f7f\u7528\u4ee5\u4e0a\u8de8\u57df\u65b9\u6cd5\uff0c\u82e5\u540c\u65f6\u8bbe\u7f6e\u4e3a allowTaint\uff1atrue \uff0c\u4ecd\u7136\u4f1a\u8ba4\u4e3a\u753b\u5e03\u5df2\u88ab\u6c61\u67d3\u800c\u4e0d\u53ef\u7528\uff1b<\/code><\/pre>\n<h3 style=\"padding: 0px; color: #4870ac; margin: 1.2em 0px 1em; font-size: 1.3em;\">\u6587\u5b57<\/h3>\n<p style=\"margin: 1em 0px;\">\u6362\u884c\u7684\u6838\u5fc3\uff1a\u6309\u6bcf\u884c\u6700\u5927\u5bbd\u5ea6\u628a\u5b57\u7b26\u4e32\u62c6\u5f00\u518d\u753b\u3002\u53c2\u8003\uff1ahttps:\/\/www.zhangxinxu.com\/wordpress\/2018\/02\/canvas-text-break-line-letter-spacing-vertical\/<\/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;\">\u6838\u5fc3\uff1a\u8ba1\u7b97\u6240\u6709\u6587\u5b57\uff0c\u6839\u636e\u6bcf\u884c\u53ef\u663e\u793a\u7684\u6700\u5927\u5bbd\u5ea6\uff0c\u6765\u62c6\u5206\u6210\u6bcf\u884c\u6e32\u67d3<\/code><\/pre>\n<p style=\"margin: 1em 0px;\">\u5b57\u4f53\uff1a\u53ea\u7528\u9ed8\u8ba4\u6216\u5c11\u91cf\u5b9a\u5236\u5b57\u4f53\u65f6\uff0c\u53ef\u7528 Fontmin \u88c1\u5207\u540e <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;\">@font-face<\/code>\u3002<strong style=\"color: #4870ac;\">\u6d89\u53ca\u7248\u6743\uff0c\u5fc5\u987b\u786e\u8ba4\u4f60\u4eec\u6709\u8be5\u5b57\u4f53\u6388\u6743<\/strong>\u3002<\/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;\">@font-face {\n    font-family: \"DIN Condensed\";\n    \/\/ prettier-ignore\n    src: url(\"~@\/assets\/fonts\/DIN-Condensed-Bold.woff\") format(\"woff\"), url(\"~@\/assets\/fonts\/DIN-Condensed-Bold.ttf\") format(\"ttf\");\n}\n\n@font-face {\n    font-family: \"PingFang SC Bold\";\n    \/\/ prettier-ignore\n    src: url(\"~@\/assets\/fonts\/PingFang-SC-Bold.ttf\") format(\"ttf\"), url(\"~@\/assets\/fonts\/PingFang-SC-Bold.woff\") format(\"woff\");\n}\nctx.fillText('20px PingFang SC Bold', x, y)\nctx.fillText('20px', x, y)<\/code><\/pre>\n<p style=\"margin: 1em 0px;\">\u5fc5\u987b\u5b8c\u6574\u67d0\u5b57\u4f53\u3001\u4e14\u6587\u6848\u52a8\u6001\u53d8\u5316\u65f6\uff0c\u8ba9\u63a5\u53e3\u51fa SVG\uff0c\u518d\u753b\u8fdb Canvas\u3002\u6ce8\u610f\u76f4\u63a5 DOM \u8f6c SVG \u5728\u5b89\u5353\u4e0a\u4e5f\u6709\u5931\u8d25\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;\">svg to img\n\u76f4\u63a5 domtoSvg \u4e5f\u6709\u5b89\u5353\u5931\u8d25\u7684\u95ee\u9898\nlet svg = \u63a5\u53e3\u83b7\u53d6svg\uff08\u53c2\u8003\u5e74\u5ea6\u8d26\u5355\uff09\nlet svgBase64: string =\n    'data:image\/svg+xml;base64,' +\n    window.btoa(\n        unescape(encodeURIComponent(svg))\n    )\n\nawait this.loadImg(svgBase64).then(\n    img =&gt; {\n        ctxC.drawImage(\n            img,\n            ~~(20 * this.scale),\n            ~~(186 * this.scale)\n        )\n    }\n)<\/code><\/pre>\n<h3 style=\"padding: 0px; color: #4870ac; margin: 1.2em 0px 1em; font-size: 1.3em;\">\u624b\u673a\u7aef\u6bd4\u4f8b<\/h3>\n<p style=\"margin: 1em 0px;\">\u5c3d\u91cf\u7528\u6574\u6570\uff0c\u6309 devicePixelRatio \u548c\u8bbe\u8ba1\u7a3f\u5bbd\u5ea6\u7b97 scale\uff0c\u907f\u514d\u7cca\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;\">\/\/ \u5c3d\u91cf\u4f7f\u7528\u6574\u6570\n\n\/\/ devicePixelRatio\nprotected imgQuality = window.devicePixelRatio\n\n\/\/ \u548c\u8bbe\u8ba1\u7a3f\u7684\u6bd4\u4f8b \u8bbe\u8ba1\u7a3f\u5bbd\u5ea6\u662f640\nget scale() {\n    return (document.body.clientWidth * this.imgQuality) \/ 640\n}\n\n\/\/ \u753b\u5e03\u5bbd\u9ad8\uff0c\u907f\u514d\u751f\u6210\u7684\u56fe\u7247\u6a21\u7cca\u60c5\u51b5\u51fa\u73b0\ncanvasBox.width = Math.ceil(\n    document.body.clientWidth * this.imgQuality\n)\ncanvasBox.height = Math.ceil(980 * this.scale)\n\n\/\/ \u4e8c\u7ef4\u7801\u7684\u5bbd\u5ea6\nget qrCodeSize() {\n    return ~~(155 * this.scale) \/\/ rpx * scale\n}<\/code><\/pre>\n<h3 style=\"padding: 0px; color: #4870ac; margin: 1.2em 0px 1em; font-size: 1.3em;\">\u7ebf\u3001\u5706\u3001\u5706\u89d2\u77e9\u5f62<\/h3>\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;\">\/\/ \u753b\u5e03\u548c\u8bbe\u8ba1\u7a3f750\u7684\u6bd4\u4f8b\nscale =  (document.body.clientWidth * this.imgQuality) \/ 750\n\/\/ \u7ebf\uff1a\n\/**\n * \u753b\u7ebf\n *\/\nexport function drawLine(\n    ctx: CanvasRenderingContext2D,\n    data: {\n        x: number\n        y: number\n        width: number\n        height: number\n        strokeStyle: string\n    },\n    scale: number\n) {\n    let x = data.x * scale\n    let y = data.y * scale\n    let dx = (data.x + data.width) * scale\n    let dy = data.y * scale\n\n    \/\/ \u5f00\u59cb\u4e00\u4e2a\u65b0\u7684\u7ed8\u5236\u8def\u5f84\n    ctx.beginPath()\n    \/\/ \u5b9a\u4e49\u76f4\u7ebf\u7684\u8d77\u70b9\u5750\u6807\u4e3a(10,10)\n    ctx.moveTo(x, y)\n    \/\/ \u5b9a\u4e49\u76f4\u7ebf\u7684\u7ec8\u70b9\u5750\u6807\u4e3a(50,10)\n    ctx.lineTo(dx, dy)\n    \/\/ \u989c\u8272\n    ctx.strokeStyle = data.strokeStyle\n    \/\/ \u6cbf\u7740\u5750\u6807\u70b9\u987a\u5e8f\u7684\u8def\u5f84\u7ed8\u5236\u76f4\u7ebf\n    ctx.stroke()\n    \/\/ \u5173\u95ed\u5f53\u524d\u7684\u7ed8\u5236\u8def\u5f84\n    ctx.closePath()\n}\n\n\/\/ \u5706\uff1a\n\/**\n * \u753b\u5706\n *\/\nexport function drawCircle(\n    ctx: CanvasRenderingContext2D,\n    data: {\n        x: number \/\/ \u5706\u5fc3\n        y: number\n        size: number \/\/ \u534a\u5f84\n        fillStyle: string\n    },\n    scale: number\n) {\n    ctx.save()\n    ctx.beginPath()\n    ctx.arc(\n        ~~(data.x * scale),\n        ~~(data.y * scale),\n        ~~(data.size * scale),\n        0,\n        ~~(data.size * scale * Math.PI)\n    )\n    ctx.fillStyle = data.fillStyle\n    ctx.fill()\n    ctx.restore()\n}\n\n\/\/ \u77e9\u5f62\uff1a\n\/**\n * \u753b\u5706\u89d2\u77e9\u5f62\n *\/\nexport function drawRoundRect(\n    ctx: CanvasRenderingContext2D,\n    data: {\n        x: number\n        y: number\n        width: number\n        height: number\n        radius: number\n        fillStyle: string\n    },\n    scale: number\n) {\n    let width = ~~(data.width * scale)\n    let height = ~~(data.height * scale)\n    let radius = ~~(data.radius * scale)\n    let fillStyle = data.fillStyle\n    ctx.save()\n    ctx.translate(~~(data.x * scale), ~~(data.y * scale))\n    ctx.beginPath()\n    \/\/ \u4ece\u53f3\u4e0b\u89d2\u987a\u65f6\u9488\u7ed8\u5236\uff0c\u5f27\u5ea6\u4ece0\u52301\/2PI\n    ctx.arc(width - radius, height - radius, radius, 0, Math.PI \/ 2)\n\n    \/\/ \u77e9\u5f62\u4e0b\u8fb9\u7ebf\n    ctx.lineTo(radius, height)\n\n    \/\/ \u5de6\u4e0b\u89d2\u5706\u5f27\uff0c\u5f27\u5ea6\u4ece1\/2PI\u5230PI\n    ctx.arc(radius, height - radius, radius, Math.PI \/ 2, Math.PI)\n\n    \/\/ \u77e9\u5f62\u5de6\u8fb9\u7ebf\n    ctx.lineTo(0, radius)\n\n    \/\/ \u5de6\u4e0a\u89d2\u5706\u5f27\uff0c\u5f27\u5ea6\u4ecePI\u52303\/2PI\n    ctx.arc(radius, radius, radius, Math.PI, (Math.PI * 3) \/ 2)\n\n    \/\/ \u4e0a\u8fb9\u7ebf\n    ctx.lineTo(width - radius, 0)\n\n    \/\/ \u53f3\u4e0a\u89d2\u5706\u5f27\n    ctx.arc(width - radius, radius, radius, (Math.PI * 3) \/ 2, Math.PI * 2)\n\n    \/\/ \u53f3\u8fb9\u7ebf\n    ctx.lineTo(width, height - radius)\n    ctx.closePath()\n    ctx.fillStyle = fillStyle\n    ctx.fill()\n    ctx.restore()\n}<\/code><\/pre>\n<p style=\"margin: 1em 0px;\">\u753b\u6574\u5706\u65f6 <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;\">arc<\/code> \u7684\u626b\u89d2\u5e94\u662f <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;\">2 * Math.PI<\/code>\u3002\u4e0a\u9762 <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;\">drawCircle<\/code> \u5199\u6210\u4e86 <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;\">size * scale * Math.PI<\/code>\uff0c\u534a\u5f84\u4e00\u5927\u5706\u5f27\u5c31\u4e0d\u95ed\u5408\uff0c\u9700\u8981\u5bf9\u9f50\u8bbe\u8ba1\u7a3f\u518d\u6539\u3002<\/p>\n<h3 style=\"padding: 0px; color: #4870ac; margin: 1.2em 0px 1em; font-size: 1.3em;\">\u5bfc\u51fa\u4e0e\u4fdd\u5b58<\/h3>\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;\">canvasBox.toBlob(async data =&gt; {\n    if (data) {\n        \/\/\u4e0a\u4f20\u52307niu\n        this.url = await uploadFile(data)\n    }\n})<\/code><\/pre>\n<p style=\"margin: 1em 0px;\">PC \u4e0b\u8f7d\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 { saveAs } from 'file-saver'\nsaveAs(blob, filename)<\/code><\/pre>\n<p style=\"margin: 1em 0px;\">H5\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;\">\u957f\u6309\u4fdd\u5b58\n\u5305\u58f3\u7684 H5 \u662f\u53ef\u4ee5\u5b9e\u73b0\u76f4\u63a5\u4e0b\u8f7d\u7684\uff0c\u4f46\u4e3a\u4e86\u4ea4\u4e92\u4e00\u81f4\u6027\uff0c\u8fd8\u662f\u7528\u4e86\u957f\u6309<\/code><\/pre>\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\u63a5\u53e3\u751f\u6210\u4e0e\u8de8\u57df<\/h2>\n<p style=\"margin: 1em 0px;\">\u628a\u5143\u7d20\u548c\u4f4d\u7f6e\u4f20\u7ed9\u540e\u7aef\uff0c\u63a5\u53e3\u76f4\u63a5\u56de\u56fe\u3002\u4f18\u70b9\u662f\u524d\u7aef\u51e0\u4e4e\u4e0d\u7528\u7ba1\u517c\u5bb9\uff1b\u7f3a\u70b9\u662f\u5b57\u6570\u3001\u5b57\u4f53\u79cd\u7c7b\u4e00\u591a\uff0c\u670d\u52a1\u5668\u538b\u529b\u5c31\u5927\uff0c\u5143\u7d20\u8d8a\u591a\u8d8a\u6162\u3002\u540e\u7aef\u540c\u6837\u8981\u7b97\u6362\u884c\u9ad8\u5ea6\uff08\u540c\u4e00\u5b57\u4f53\u4e2d\u82f1\u6587\u5bbd\u5ea6\u4e0d\u540c\uff09\u548c\u540e\u7eed\u5143\u7d20\u76f8\u5bf9\u4f4d\u7f6e\u3002<\/p>\n<p style=\"margin: 1em 0px;\">\u8de8\u57df\u56fe\u5bfc\u4e0d\u4e0b\u6765\u65f6\uff0c\u628a\u4e0b\u9762\u8fd9\u6bb5\u770b\u5b8c\u3002\u6765\u6e90\uff1a<a class=\"url\" href=\"https:\/\/segmentfault.com\/q\/10\" target=\"_blank\">https:\/\/segmentfault.com\/q\/10<\/a>&#8230;<\/p>\n<p style=\"margin: 1em 0px;\"><a href=\"https:\/\/ai.zhousir.top\/wp-content\/uploads\/2021\/04\/20210425084029.png\" rel=\"fancybox\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-3246\" src=\"https:\/\/ai.zhousir.top\/wp-content\/uploads\/2021\/04\/20210425084029.png\" alt=\"20210425084029\" width=\"1075\" height=\"654\" \/><\/a><\/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;\">\u516d\u3001\u600e\u4e48\u9009<\/h2>\n<p style=\"margin: 1em 0px;\">\u65e0\u7279\u6b8a\u60c5\u51b5\uff0cPC \u7528 dom-to-image \u5373\u53ef\u3002H5 \u8fd9\u8fb9\u8d70\u8fc7\u7684\u8def\uff1a<\/p>\n<ol style=\"padding-left: 1rem; margin-left: 1rem; font-size: 0.9rem;\">\n<li>\n<section>\u7b2c\u4e09\u65b9\u5e93\uff08\u517c\u5bb9\u95ee\u9898\uff0c\u592a\u4e45\u8fdc\u53ea\u8bb0\u5f97\u65b9\u6848\u88ab\u9a73\u56de\uff09<\/section>\n<\/li>\n<li>\n<section>\u63a5\u53e3\u7ed8\u5236\uff08\u670d\u52a1\u5668\u8fc7\u8f7d\uff0c\u592a\u6162\uff09<\/section>\n<\/li>\n<li>\n<section>\u524d\u7aef Canvas\uff08\u90e8\u5206\u5143\u7d20\u7531\u63a5\u53e3\u753b\u6210\u56fe\u6216 SVG \u518d\u8d34\u4e0a\uff0c\u517c\u5bb9\u8fd8\u884c\uff0c\u4f46\u4ecd\u6162\uff09<\/section>\n<\/li>\n<li>\n<section>\u518d\u56de\u5230 html2canvas\uff08\u6d4b\u8fc7\u82e5\u5e72\u73af\u5883\uff0c\u9879\u76ee\u5f53\u65f6\u672a\u4e0a\u7ebf\uff0c\u8fd8\u9700\u89c2\u5bdf\uff09<\/section>\n<\/li>\n<\/ol>\n<p style=\"margin: 1em 0px;\">\u5f53\u65f6\u770b\u8d77\u6765 html2canvas \u66f4\u7a33\uff0c\u4f46\u6709\u4e9b\u6548\u679c\u753b\u4e0d\u51fa\u6765\uff0c\u8981\u5728\u8fd8\u539f\u5ea6\u548c\u6027\u80fd\u4e4b\u95f4\u53d6\u820d\u3002\u4e0d\u5c11 App \u51fa\u6d77\u62a5\u66f4\u5feb\uff0c\u53ef\u80fd\u662f\u539f\u751f\u80fd\u529b\uff0cH5 \u672c\u8eab\u6709\u9650\u5236\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;\">\u65b9\u6848<\/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;\">\u9002\u5408<\/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;\">\u4f18\u70b9<\/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;\">\u77ed\u677f<\/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;\">html2canvas<\/td>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">H5 \u591a\u7aef<\/td>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">\u517c\u5bb9\u9762\u76f8\u5bf9\u5bbd<\/td>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">\u4f2a\u7c7b \/ dash \/ text-shadow \u4e0d\u652f\u6301<\/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;\">dom-to-image<\/td>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">PC Chrome<\/td>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">\u8fd8\u539f\u5ea6\u9ad8<\/td>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">\u4e0d\u652f\u6301 Safari\uff0c\u505c\u66f4\uff1biOS 14.2 \u6613\u4e22\u56fe<\/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;\">Canvas \u624b\u7ed8<\/td>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">\u7248\u5f0f\u56fa\u5b9a\u3001\u8981\u63a7\u6e05\u6670\u5ea6<\/td>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">\u8de8\u57df\u3001\u5b57\u4f53\u3001\u6bd4\u4f8b\u90fd\u53ef\u81ea\u5df1\u7ba1<\/td>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">\u5f00\u53d1\u91cf\u5927\uff0c\u6587\u5b57\u6362\u884c\u548c\u7248\u6743\u70e6<\/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;\">\u63a5\u53e3\u51fa\u56fe<\/td>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">\u524d\u7aef\u73af\u5883\u592a\u4e71<\/td>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">\u524d\u7aef\u65e0\u517c\u5bb9\u5305\u88b1<\/td>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">\u5b57\u591a\u3001\u5143\u7d20\u591a\u5c31\u6162\uff0c\u670d\u52a1\u5668\u538b\u529b\u5927<\/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;\">\u4e03\u3001\u53c2\u8003<\/h2>\n<ol style=\"padding-left: 1rem; margin-left: 1rem; font-size: 0.9rem;\">\n<li>\n<section>\u3010JS\u3011\u8282\u70b9\u622a\u56fe\u7684\u6700\u7ec8\u89e3\u51b3\u65b9\u6848 dom-to-image \u4e0e html2canvas\uff1a<a class=\"url\" href=\"https:\/\/blog.csdn.net\/Mcky_Lo\" target=\"_blank\">https:\/\/blog.csdn.net\/Mcky_Lo<\/a>&#8230;<\/section>\n<\/li>\n<li>\n<section>\u79fb\u52a8\u7aef H5 \u9875\u9762\u622a\u56fe\uff1a<a class=\"url\" href=\"https:\/\/cloud.tencent.com\/dev\" target=\"_blank\">https:\/\/cloud.tencent.com\/dev<\/a>&#8230;<\/section>\n<\/li>\n<li>\n<section>\u628a DOM \u8282\u70b9\u751f\u6210 base64 \u56fe\u7247\uff1a<a class=\"url\" href=\"https:\/\/www.jianshu.com\/p\/c5c\" target=\"_blank\">https:\/\/www.jianshu.com\/p\/c5c<\/a>&#8230;<\/section>\n<\/li>\n<li>\n<section>\u66f4\u4f18\u96c5\u5730\u57fa\u4e8e canvas \u5728\u524d\u7aef\u753b\u6d77\u62a5\uff1a<a class=\"url\" href=\"https:\/\/juejin.cn\/post\/684490\" target=\"_blank\">https:\/\/juejin.cn\/post\/684490<\/a>&#8230;<\/section>\n<\/li>\n<li>\n<section>canvas \u6587\u672c\u7ed8\u5236\u81ea\u52a8\u6362\u884c\u3001\u5b57\u95f4\u8ddd\u3001\u7ad6\u6392\u7b49\u5b9e\u73b0 <a class=\"url\" href=\"https:\/\/www.zhangxinxu.com\/wo\" target=\"_blank\">https:\/\/www.zhangxinxu.com\/wo<\/a>&#8230;<\/section>\n<\/li>\n<li>\n<section>\u56fe\u7247\u8de8\u57df\u95ee\u9898\uff1a<a class=\"url\" href=\"https:\/\/segmentfault.com\/q\/1010000008648867\" target=\"_blank\">https:\/\/segmentfault.com\/q\/1010000008648867<\/a><\/section>\n<\/li>\n<li>\n<section><a class=\"url\" href=\"https:\/\/mp.weixin.qq.com\/s\/UB9cCPPf7k_vVvlrcbka-g\" target=\"_blank\">https:\/\/mp.weixin.qq.com\/s\/UB9cCPPf7k_vVvlrcbka-g<\/a><\/section>\n<\/li>\n<\/ol>\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\u6d77\u62a5\u6ca1\u6709\u94f6\u5f39\uff1aPC \u4f18\u5148 dom-to-image\uff0cH5 \u66f4\u5e38\u843d\u5230 html2canvas \u6216 Canvas\uff1b\u8de8\u57df\u3001\u5b57\u4f53\u3001DPR \u624d\u662f\u771f\u6b63\u8017\u65f6\u7684\u5730\u65b9\u3002<\/strong><\/p>\n<\/blockquote>\n<\/section>\n","protected":false},"excerpt":{"rendered":"<p>\u4e1a\u52a1\u91cc\u7ecf\u5e38\u8981\u751f\u6210\u5206\u4eab\u6d77\u62a5\uff1aPC \u5206\u4eab\u56fe\u3001H5 \u4f18\u60e0\u5238\u3001\u5e74\u5ea6\u8d26\u5355\u3002\u9700\u6c42\u4e0d\u540c\uff0c\u65b9\u6848\u4e5f\u4e0d\u540c\u2014\u2014\u7b2c\u4e09\u65b9\u5e93\u3001\u81ea\u5df1\u7528 Ca [&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":[156,150],"_links":{"self":[{"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=\/wp\/v2\/posts\/3241"}],"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=3241"}],"version-history":[{"count":3,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=\/wp\/v2\/posts\/3241\/revisions"}],"predecessor-version":[{"id":3247,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=\/wp\/v2\/posts\/3241\/revisions\/3247"}],"wp:attachment":[{"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3241"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3241"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3241"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}