{"id":33268,"date":"2024-11-25T17:48:23","date_gmt":"2024-11-25T09:48:23","guid":{"rendered":"https:\/\/fwq.ai\/blog\/33268\/"},"modified":"2024-11-25T17:48:23","modified_gmt":"2024-11-25T09:48:23","slug":"%e5%be%ae%e4%bf%a1%e5%b0%8f%e7%a8%8b%e5%ba%8f%ef%bc%9a%e4%b8%80%e4%b8%aajson%e5%b8%ae%e4%bd%a0%e5%ae%8c%e6%88%90%e5%88%86%e4%ba%ab%e6%9c%8b%e5%8f%8b%e5%9c%88%e5%9b%be%e7%89%87","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/33268\/","title":{"rendered":"\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\uff1a\u4e00\u4e2ajson\u5e2e\u4f60\u5b8c\u6210\u5206\u4eab\u670b\u53cb\u5708\u56fe\u7247"},"content":{"rendered":"<p><strong>\u5199\u5728\u524d\u9762<\/strong><\/p>\n<hr>\n<p>\u6700\u8fd1\u5728\u505a\u5c0f\u7a0b\u5e8f\uff0c\u53d1\u73b0\u5236\u4f5c\u5206\u4eab\u5230\u670b\u53cb\u5708\u56fe\u7247\u662f\u6bcf\u4e2a\u9879\u76ee\u5fc5\u987b\u7684\u3002\u9047\u5230\u5751\u6bd4\u8f83\u591a\uff0c\u5199\u8d77\u6765\u4e5f\u6bd4\u8f83\u7e41\u7410\uff0c\u4e5f\u6ca1\u6709\u627e\u5230\u7c7b\u4f3c\u7ec4\u4ef6\uff0c\u6240\u4ee5\u5c31\u81ea\u5df1\u52a8\u624b\u5199\u4e86\u4e00\u4e2a\u3002<\/p>\n<p>\u6f14\u793a<\/p>\n<hr>\n<p style=\"text-align: center\"><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/image\/985\/668\/526\/1591925235193669.png\" class=\"aligncenter\" title=\"\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\uff1a\u4e00\u4e2ajson\u5e2e\u4f60\u5b8c\u6210\u5206\u4eab\u670b\u53cb\u5708\u56fe\u7247\u63d2\u56fe\" alt=\"\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\uff1a\u4e00\u4e2ajson\u5e2e\u4f60\u5b8c\u6210\u5206\u4eab\u670b\u53cb\u5708\u56fe\u7247\u63d2\u56fe\" \/><\/p>\n<p>\u5de6\u4fa7\u662f&nbsp;canvasdrawer&nbsp;\u7ed8\u5236\u7684\uff0c\u53f3\u4fa7\u662fUI\u7ed9\u7684\u56fe<\/p>\n<p style=\"text-align: center\"><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/image\/620\/607\/763\/1591925285188933.png\" class=\"aligncenter\" title=\"\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\uff1a\u4e00\u4e2ajson\u5e2e\u4f60\u5b8c\u6210\u5206\u4eab\u670b\u53cb\u5708\u56fe\u7247\u63d2\u56fe1\" alt=\"\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\uff1a\u4e00\u4e2ajson\u5e2e\u4f60\u5b8c\u6210\u5206\u4eab\u670b\u53cb\u5708\u56fe\u7247\u63d2\u56fe1\" \/><\/p>\n<p><strong>\u7279\u6027<\/strong><\/p>\n<hr>\n<ul>\n<li>\n<p>\u7b80\u5355\u6613\u7528 \u2014\u2014 \u4e00\u4e2a&nbsp;json&nbsp;\u641e\u5b9a\u7ed8\u5236\u56fe\u7247<\/p>\n<\/li>\n<li>\n<p>\u529f\u80fd\u5168 \u2014\u2014 \u6ee1\u8db3&nbsp;90%&nbsp;\u7684\u4f7f\u7528\u573a\u666f<\/p>\n<\/li>\n<li>\n<p>\u7ed8\u5236\u6587\u672c\uff08\u6362\u884c\u3001\u8d85\u51fa\u5185\u5bb9\u7701\u7565\u53f7\u3001\u4e2d\u5212\u7ebf\u3001\u4e0b\u5212\u7ebf\u3001\u6587\u672c\u52a0\u7c97\uff09<\/p>\n<\/li>\n<ul>\n<li>\n<p>\u7ed8\u5236\u56fe\u7247<\/p>\n<\/li>\n<li>\n<p>\u7ed8\u5236\u77e9\u5f62<\/p>\n<\/li>\n<li>\n<p>\u4fdd\u5b58\u56fe\u7247<\/p>\n<\/li>\n<li>\n<p>\u591a\u56fe\u7ed8\u5236<\/p>\n<\/li>\n<li>\n<p>&#8230;<\/p>\n<\/li>\n<\/ul>\n<li>\n<p>\u4ee3\u7801\u91cf\u5c0f<\/p>\n<\/li>\n<\/ul>\n<p><strong>\u4f53\u9a8c<\/strong><\/p>\n<pre>git&nbsp;clone&nbsp;https:\/\/github.com\/kuckboy1994\/mp_canvas_drawer<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u60f3\u5728\u624b\u673a\u4e0a\u4f7f\u7528\u914d\u7f6e\u81ea\u5df1\u7684&nbsp;appid&nbsp;\u5373\u53ef\u3002<\/p>\n<p>\u7f16\u8bd1\u6a21\u5f0f\u4e2d\u5df2\u7ecf\u4e3a\u4f60\u914d\u7f6e\u597d\u6bd4\u8f83\u5e38\u7528\u7684\u4e24\u79cd\u6a21\u5f0f\uff1a<\/p>\n<ul>\n<li>\n<p>\u666e\u901a\u7ed8\u5236\uff0c\u7ed8\u5236\u5355\u5f20\u5206\u4eab\u56fe\u3002<\/p>\n<\/li>\n<li>\n<p>\u591a\u56fe\u7ed8\u5236\uff0c\u8fde\u7eed\u7ed8\u5236\u5206\u4eab\u56fe<\/p>\n<\/li>\n<\/ul>\n<p><strong>\u4f7f\u7528<\/strong><\/p>\n<hr>\n<ul>\n<li>\n<p>git clone https:\/\/github.com\/kuckboy1994\/mp_canvas_drawer&nbsp;\u5230\u672c\u5730<\/p>\n<\/li>\n<li>\n<p>\u628a&nbsp;components&nbsp;\u4e2d\u7684&nbsp;canvasdrawer&nbsp;\u62f7\u8d1d\u5230\u81ea\u5df1\u9879\u76ee\u4e0b\u3002<\/p>\n<\/li>\n<li>\n<p>\u5728\u4f7f\u7528\u9875\u9762\u6ce8\u518c\u7ec4\u4ef6<\/p>\n<\/li>\n<\/ul>\n<pre>{\n&nbsp;&nbsp;\"usingComponents\":&nbsp;{\n&nbsp;&nbsp;&nbsp;&nbsp;\"canvasdrawer\":&nbsp;\"\/components\/canvasdrawer\/canvasdrawer\"\n&nbsp;&nbsp;}\n}<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<ul>\n<li>\n<p>\u5728\u9875\u9762&nbsp;**.wxml&nbsp;\u6587\u4ef6\u4e2d\u52a0\u5165\u5982\u4e0b\u4ee3\u7801<\/p>\n<\/li>\n<\/ul>\n<pre>&lt;canvasdrawer&gt;&lt;\/canvasdrawer&gt;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;painting&nbsp;\u662f\u9700\u8981\u4f20\u5165\u7684&nbsp;json\u3002&nbsp;getImage&nbsp;\u65b9\u6cd5\u662f\u7ed8\u56fe\u5b8c\u6210\u4e4b\u540e\u7684\u56de\u8c03\u51fd\u6570\uff0c\u5728&nbsp;event.detail&nbsp;\u4e2d\u8fd4\u56de\u7ed8\u5236\u5b8c\u6210\u7684\u56fe\u7247\u5730\u5740\u3002<\/p>\n<ul>\n<li>\n<p>\u5f53\u524d\u6817\u5b50\u4e2d\u7684&nbsp;painting&nbsp;\u7b80\u5355\u5c55\u793a\u4e00\u4e0b\u3002\u8be6\u7ec6\u914d\u7f6e\u8bf7\u770b&nbsp;<\/p>\n<\/li>\n<\/ul>\n<p><strong>API<\/strong><\/p>\n<hr>\n<p>\u6570\u636e\u5bf9\u8c61\u7684\u7b2c\u4e00\u5c42\u9700\u8981\u4e09\u4e2a\u53c2\u6570: width\u3001height\u3001views\u3002\u914d\u7f6e\u4e2d\u6240\u6709\u7684\u6570\u5b57\u90fd\u662f\u6ca1\u6709\u5355\u4f4d\u7684\u3002\u8fd9\u5c31\u610f\u5473\u7740 canvas \u7ed8\u5236\u7684\u662f\u4e00\u4e2a\u6bd4\u4f8b\u56fe\u3002\u5177\u4f53\u663e\u793a\u7684\u5927\u5c0f\u76f4\u63a5\u628a\u8fd4\u56de\u7684\u56fe\u7247\u8def\u5f84\u653e\u7f6e\u5230 image \u6807\u7b7e\u4e2d\u5373\u53ef\u3002<\/p>\n<p>\u5f53\u524d\u53ef\u4ee5\u7ed8\u52363\u79cd\u7c7b\u578b\u7684\u914d\u7f6e: image\u3001text\u3001rect\u3002\u914d\u7f6e\u7684\u5c5e\u6027\u57fa\u672c\u4e0a\u4f7f\u7528\u7684\u90fd\u662f css \u7684\u9a7c\u5cf0\u540d\u79f0\uff0c\u8fd8\u662f\u6bd4\u8f83\u597d\u7406\u89e3\u7684\u3002<\/p>\n<p><strong>image\uff08\u56fe\u7247\uff09<\/strong><\/p>\n<p><\/p>\n<table>\n<tbody>\n<tr>\n<td width=\"116\">\u5c5e\u6027<\/td>\n<td rowspan=\"1\" colspan=\"2\" width=\"212\">\u542b\u4e49<\/td>\n<td width=\"122\">\u9ed8\u8ba4\u503c <\/td>\n<td colspan=\"1\" rowspan=\"1\" width=\"136\">\u53ef\u9009\u503c<\/td>\n<\/tr>\n<tr>\n<td width=\"116\">url<\/td>\n<td rowspan=\"1\" colspan=\"2\" width=\"212\">\u7ed8\u5236\u7684\u56fe\u7247\u5730\u5740\uff0c\u53ef\u4ee5\u662f\u672c\u5730\u56fe\u7247\uff0c\u5982\uff1a\/images\/1.jpeg<\/td>\n<td width=\"122\"><\/td>\n<td colspan=\"1\" rowspan=\"1\" width=\"136\"><\/td>\n<\/tr>\n<tr>\n<td width=\"116\">top<\/td>\n<td rowspan=\"1\" colspan=\"2\" width=\"212\">\u5de6\u4e0a\u89d2\u8ddd\u79bb\u753b\u677f\u9876\u90e8\u7684\u8ddd\u79bb<\/td>\n<td width=\"122\"><\/td>\n<td colspan=\"1\" rowspan=\"1\" width=\"136\"><\/td>\n<\/tr>\n<tr>\n<td width=\"116\">left<\/td>\n<td rowspan=\"1\" colspan=\"2\" width=\"212\">\u5de6\u4e0a\u89d2\u8ddd\u79bb\u753b\u677f\u5de6\u4fa7\u7684\u8ddd\u79bb<\/td>\n<td width=\"122\"><\/td>\n<td colspan=\"1\" rowspan=\"1\" width=\"136\"><\/td>\n<\/tr>\n<tr>\n<td colspan=\"1\" rowspan=\"1\">width<\/td>\n<td colspan=\"2\" rowspan=\"1\">\u8981\u753b\u591a\u5bbd<\/td>\n<td colspan=\"1\" rowspan=\"1\">0<\/td>\n<td colspan=\"1\" rowspan=\"1\"><\/td>\n<\/tr>\n<tr>\n<td colspan=\"1\" rowspan=\"1\">height<\/td>\n<td colspan=\"2\" rowspan=\"1\">\u8981\u753b\u591a\u9ad8<\/td>\n<td colspan=\"1\" rowspan=\"1\">0<\/td>\n<td colspan=\"1\" rowspan=\"1\"><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><strong><span style=\"font-size: 14px\">text\uff08\u6587\u672c\uff09<\/span><\/strong><\/p>\n<table>\n<tbody>\n<tr>\n<td width=\"116\">\u5c5e\u6027<\/td>\n<td rowspan=\"1\" colspan=\"2\" width=\"195\">\u542b\u4e49<\/td>\n<td width=\"139\">\u9ed8\u8ba4\u503c <\/td>\n<td colspan=\"1\" rowspan=\"1\" width=\"136\">\u53ef\u9009\u503c<\/td>\n<\/tr>\n<tr>\n<td width=\"116\">content<\/td>\n<td rowspan=\"1\" colspan=\"2\" width=\"195\">\u7ed8\u5236\u7684\u56fe\u7247\u5730\u5740<\/td>\n<td width=\"139\">&#8221;(\u7a7a\u5b57\u7b26\u4e32)<\/td>\n<td colspan=\"1\" rowspan=\"1\" width=\"136\"><\/td>\n<\/tr>\n<tr>\n<td width=\"116\">color<\/td>\n<td rowspan=\"1\" colspan=\"2\" width=\"195\">\u989c\u8272<\/td>\n<td width=\"139\">black<\/td>\n<td colspan=\"1\" rowspan=\"1\" width=\"136\"><\/td>\n<\/tr>\n<tr>\n<td width=\"116\">fontSize<\/td>\n<td rowspan=\"1\" colspan=\"2\" width=\"195\">\u5b57\u4f53\u5927\u5c0f<\/td>\n<td width=\"139\">16<\/td>\n<td colspan=\"1\" rowspan=\"1\" width=\"136\"><\/td>\n<\/tr>\n<tr>\n<td colspan=\"1\" rowspan=\"1\">textAlign<\/td>\n<td colspan=\"2\" rowspan=\"1\" width=\"195\">\u6587\u5b57\u5bf9\u9f50\u65b9\u5f0f<\/td>\n<td colspan=\"1\" rowspan=\"1\" width=\"139\">left<\/td>\n<td colspan=\"1\" rowspan=\"1\">center,right<\/td>\n<\/tr>\n<tr>\n<td colspan=\"1\" rowspan=\"1\">lineHeight<\/td>\n<td colspan=\"2\" rowspan=\"1\" width=\"195\">\u884c\u9ad8\uff0c\u53ea\u6709\u5728\u591a\u884c\u6587\u672c\u4e2d\u624d\u6709\u7528<\/td>\n<td colspan=\"1\" rowspan=\"1\" width=\"139\">20<\/td>\n<td colspan=\"1\" rowspan=\"1\"><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p style=\"line-height: 1.5;margin-top: 35px;margin-bottom: 10px;padding-bottom: 0px;font-size: 18px;font-family: -apple-system, system-ui, BlinkMacSystemFont,\"><strong><span style=\"font-size: 14px\">rect (\u77e9\u5f62\uff0c\u7ebf\u6761)<\/span><\/strong><\/p>\n<p style=\"line-height: 1.5;margin-top: 35px;margin-bottom: 10px;padding-bottom: 0px;font-size: 18px;font-family: -apple-system, system-ui, BlinkMacSystemFont,\"><strong><span style=\"font-size: 14px\"><\/span><\/strong><\/p>\n<table>\n<tbody>\n<tr>\n<td width=\"116\">\u5c5e\u6027<\/td>\n<td rowspan=\"1\" colspan=\"2\" width=\"230\">\u542b\u4e49<\/td>\n<td width=\"104\">\u9ed8\u8ba4\u503c <\/td>\n<td colspan=\"1\" rowspan=\"1\" width=\"136\">\u53ef\u9009\u503c<\/td>\n<\/tr>\n<tr>\n<td width=\"116\">background<\/td>\n<td rowspan=\"1\" colspan=\"2\" width=\"230\">\u80cc\u666f\u989c\u8272<\/td>\n<td width=\"104\">black<\/td>\n<td colspan=\"1\" rowspan=\"1\" width=\"136\"><\/td>\n<\/tr>\n<tr>\n<td width=\"116\">top<\/td>\n<td rowspan=\"1\" colspan=\"2\" width=\"230\">\u5de6\u4e0a\u89d2\u8ddd\u79bb\u753b\u677f\u9876\u90e8\u7684\u8ddd\u79bb<\/td>\n<td width=\"104\"><\/td>\n<td colspan=\"1\" rowspan=\"1\" width=\"136\"><\/td>\n<\/tr>\n<tr>\n<td width=\"116\">left<\/td>\n<td rowspan=\"1\" colspan=\"2\" width=\"230\">\u5de6\u4e0a\u89d2\u8ddd\u79bb\u753b\u677f\u5de6\u4fa7\u7684\u8ddd\u79bb<\/td>\n<td width=\"104\">16<\/td>\n<td colspan=\"1\" rowspan=\"1\" width=\"136\"><\/td>\n<\/tr>\n<tr>\n<td colspan=\"1\" rowspan=\"1\">width<\/td>\n<td colspan=\"2\" rowspan=\"1\" width=\"230\">\u8981\u753b\u591a\u5bbd<\/td>\n<td colspan=\"1\" rowspan=\"1\" width=\"104\">0<\/td>\n<td colspan=\"1\" rowspan=\"1\"><\/td>\n<\/tr>\n<tr>\n<td colspan=\"1\" rowspan=\"1\">height<\/td>\n<td colspan=\"2\" rowspan=\"1\" width=\"230\">\u8981\u753b\u591a\u9ad8<\/td>\n<td colspan=\"1\" rowspan=\"1\" width=\"104\">0<\/td>\n<td colspan=\"1\" rowspan=\"1\"><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p style=\"line-height: 1.5;margin-top: 35px;margin-bottom: 10px;padding-bottom: 0px;font-size: 18px;font-family: -apple-system, system-ui, BlinkMacSystemFont,\"><strong><span style=\"font-size: 14px\"><\/span><\/strong><\/p>\n<p><strong>Q&amp;A<\/strong><\/p>\n<\/p>\n<hr>\n<p>\u6700\u4f73\u5b9e\u8df5<\/p>\n<p>\u7ed8\u5236\u64cd\u4f5c\u7684\u65f6\u5019\u6700\u597d&nbsp;\u9501\u4f4f\u5c4f\u5e55&nbsp;\uff0c\u4f8b\u5982\u5728\u70b9\u51fb\u7ed8\u5236\u7684\u65f6\u5019<\/p>\n<pre>wx.showLoading({&nbsp;&nbsp;title:&nbsp;'\u7ed8\u5236\u5206\u4eab\u56fe\u7247\u4e2d',&nbsp;&nbsp;mask:&nbsp;true})<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u7ed8\u5236\u5b8c\u6210\u4e4b\u540e<\/p>\n<pre>wx.hideLoading()<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u5177\u4f53\u53ef\u4ee5\u53c2\u8003\u9879\u76ee\u4e0b\u7684 \/pages\/multiple<\/p>\n<p>1.\u4e8c\u7ef4\u7801\u548c\u5c0f\u7a0b\u5e8f\u7801\u5982\u4f55\u7ed8\u5236\uff1f<\/p>\n<ul>\n<li>\n<p>&nbsp;&nbsp;&nbsp;\u4e8c\u7ef4\u7801\u548c\u5c0f\u7a0b\u5e8f\u7801\u53ef\u4ee5\u901a\u8fc7\u8c03\u7528\u5fae\u4fe1\u5b98\u65b9\u7684\u63a5\u53e3\u4ea7\u751f\uff0c\u9700\u8981\u540e\u7aef\u914d\u5408\u3002<\/p>\n<\/li>\n<li>\n<p>&nbsp; \u7136\u540e\u8d70 type: image \u7c7b\u578b\u8fdb\u884c\u7ed8\u5236\u5373\u53ef\u3002<\/p>\n<\/li>\n<\/ul>\n<p>2.\u7ed8\u5236\u6d41\u7a0b\u76f8\u5173<\/p>\n<ul>\n<li>\n<p>&nbsp;&nbsp;views \u6570\u7ec4\u4e2d\u7684\u987a\u5e8f\u4ee3\u8868\u7ed8\u753b\u7684\u5148\u540e\u987a\u5e8f\uff0c\u4f1a\u6709\u8986\u76d6\u7684\u73b0\u8c61\u3002\u8bf7\u5404\u4f4d\u4f7f\u7528\u8005\u6ce8\u610f\u3002<\/p>\n<\/li>\n<\/ul>\n<p>3.\u5982\u4f55\u5b9e\u73b0\u5706\u5f62\u5934\u50cf\uff1f<\/p>\n<ul>\n<li>\n<p>&nbsp; &nbsp;canvas \u4e2d\u6ca1\u6709\u7ed8\u5236\u5706\u5f62\u56fe\u7247\u7684\u65b9\u6cd5\uff0c\u6240\u4ee5\u4f7f\u7528\u4e86 hack \u7684\u65b9\u5f0f\u6765\u5b9e\u73b0\u7684\u3002\u4f7f\u7528\u4e00\u5f20\u4e2d\u95f4\u9542\u7a7a\u7684\u56fe\u7247\u76d6\u5728\u5934\u50cf\u4e0a\u5c31\u53ef\u5b9e\u73b0\u5f53\u524d\u6548\u679c\u3002<\/p>\n<\/li>\n<\/ul>\n<p>4.canvas drawer \u7ec4\u4ef6\u4e3a\u4ec0\u4e48\u4e0d\u76f4\u63a5\u663e\u793acanvas\u753b\u677f\u548c\u5176\u5185\u5bb9\u5462\uff1f<\/p>\n<ul>\n<li>\n<p>&nbsp;&nbsp;&nbsp;&nbsp;\u8003\u8651\u5230\u5927\u90e8\u5206\u573a\u666f\uff0c\u6211\u4eec\u90fd\u662f\u7528\u6765\u628a\u56fe\u7247\u4fdd\u5b58\u5230\u672c\u5730\uff0c\u6216\u7528\u4ee5\u5c55\u793a\u3002\u4fdd\u5b58\u5230\u672c\u5730\uff0c\u8fd4\u56de\u4e34\u65f6\u6587\u4ef6\u7ed9\u8c03\u7528\u8005\u4e00\u5b9a\u662f\u6700\u4f73\u7684\u89e3\u51b3\u65b9\u5f0f\u3002\u5c55\u793a\uff0c\u8f6c\u5316\u6210\u56fe\u7247\u4e4b\u540e\uff0c\u5c31\u53ef\u4ee5\u4f7f\u7528 image \u57fa\u7840\u7ec4\u4ef6\u7684\u6240\u6709\u663e\u793a\u6a21\u5f0f\u4e86\uff0c\u8fd8\u80fd\u8bbe\u7f6e\u5bbd\u9ad8\u3002<\/p>\n<\/li>\n<\/ul>\n<p>\u63a8\u8350\u6559\u7a0b\uff1a\u300a\u300b<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\uff1a\u4e00\u4e2ajson\u5e2e\u4f60\u5b8c\u6210\u5206\u4eab\u670b\u53cb\u5708\u56fe\u7247\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5199\u5728\u524d\u9762 \u6700\u8fd1\u5728\u505a\u5c0f\u7a0b\u5e8f\uff0c\u53d1\u73b0\u5236\u4f5c\u5206\u4eab\u5230\u670b\u53cb\u5708\u56fe\u7247\u662f\u6bcf\u4e2a\u9879\u76ee\u5fc5\u987b\u7684\u3002\u9047\u5230\u5751\u6bd4\u8f83\u591a\uff0c\u5199\u8d77\u6765\u4e5f\u6bd4\u8f83\u7e41\u7410\uff0c\u4e5f\u6ca1\u6709\u627e\u5230\u7c7b\u4f3c\u7ec4\u4ef6\uff0c\u6240\u4ee5\u5c31\u81ea\u5df1\u52a8\u624b\u5199\u4e86\u4e00\u4e2a\u3002 \u6f14\u793a \u5de6\u4fa7\u662f&nbsp;canvasdrawer&nbsp;\u7ed8\u5236\u7684\uff0c\u53f3\u4fa7\u662fUI\u7ed9\u7684\u56fe \u7279\u6027 \u7b80\u5355\u6613\u7528 \u2014\u2014 \u4e00\u4e2a&nbsp;json&nbsp;\u641e\u5b9a\u7ed8\u5236\u56fe\u7247 \u529f\u80fd\u5168 \u2014\u2014 \u6ee1\u8db3&nbsp;90%&nbsp;\u7684\u4f7f\u7528\u573a\u666f \u7ed8\u5236\u6587\u672c\uff08\u6362\u884c\u3001\u8d85\u51fa\u5185\u5bb9\u7701\u7565\u53f7\u3001\u4e2d\u5212\u7ebf\u3001\u4e0b\u5212\u7ebf\u3001\u6587\u672c\u52a0\u7c97\uff09 \u7ed8\u5236\u56fe\u7247 \u7ed8\u5236\u77e9\u5f62 \u4fdd\u5b58\u56fe\u7247 \u591a\u56fe\u7ed8\u5236 &#8230; \u4ee3\u7801\u91cf\u5c0f \u4f53\u9a8c git&nbsp;clone&nbsp;https:\/\/github.com\/kuckboy1994\/mp_canvas_drawer \u767b\u5f55\u540e\u590d\u5236 \u60f3\u5728\u624b\u673a\u4e0a\u4f7f\u7528\u914d\u7f6e\u81ea\u5df1\u7684&nbsp;appid&nbsp;\u5373\u53ef\u3002 \u7f16\u8bd1\u6a21\u5f0f\u4e2d\u5df2\u7ecf\u4e3a\u4f60\u914d\u7f6e\u597d\u6bd4\u8f83\u5e38\u7528\u7684\u4e24\u79cd\u6a21\u5f0f\uff1a \u666e\u901a\u7ed8\u5236\uff0c\u7ed8\u5236\u5355\u5f20\u5206\u4eab\u56fe\u3002 \u591a\u56fe\u7ed8\u5236\uff0c\u8fde\u7eed\u7ed8\u5236\u5206\u4eab\u56fe \u4f7f\u7528 git clone https:\/\/github.com\/kuckboy1994\/mp_canvas_drawer&nbsp;\u5230\u672c\u5730 \u628a&nbsp;components&nbsp;\u4e2d\u7684&nbsp;canvasdrawer&nbsp;\u62f7\u8d1d\u5230\u81ea\u5df1\u9879\u76ee\u4e0b\u3002 \u5728\u4f7f\u7528\u9875\u9762\u6ce8\u518c\u7ec4\u4ef6 { &nbsp;&nbsp;&#8220;usingComponents&#8221;:&nbsp;{ &nbsp;&nbsp;&nbsp;&nbsp;&#8220;canvasdrawer&#8221;:&nbsp;&#8220;\/components\/canvasdrawer\/canvasdrawer&#8221; &nbsp;&nbsp;} } \u767b\u5f55\u540e\u590d\u5236 \u5728\u9875\u9762&nbsp;**.wxml&nbsp;\u6587\u4ef6\u4e2d\u52a0\u5165\u5982\u4e0b\u4ee3\u7801 &lt;canvasdrawer&gt;&lt;\/canvasdrawer&gt; \u767b\u5f55\u540e\u590d\u5236 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;painting&nbsp;\u662f\u9700\u8981\u4f20\u5165\u7684&nbsp;json\u3002&nbsp;getImage&nbsp;\u65b9\u6cd5\u662f\u7ed8\u56fe\u5b8c\u6210\u4e4b\u540e\u7684\u56de\u8c03\u51fd\u6570\uff0c\u5728&nbsp;event.detail&nbsp;\u4e2d\u8fd4\u56de\u7ed8\u5236\u5b8c\u6210\u7684\u56fe\u7247\u5730\u5740\u3002 \u5f53\u524d\u6817\u5b50\u4e2d\u7684&nbsp;painting&nbsp;\u7b80\u5355\u5c55\u793a\u4e00\u4e0b\u3002\u8be6\u7ec6\u914d\u7f6e\u8bf7\u770b&nbsp; API \u6570\u636e\u5bf9\u8c61\u7684\u7b2c\u4e00\u5c42\u9700\u8981\u4e09\u4e2a\u53c2\u6570: width\u3001height\u3001views\u3002\u914d\u7f6e\u4e2d\u6240\u6709\u7684\u6570\u5b57\u90fd\u662f\u6ca1\u6709\u5355\u4f4d\u7684\u3002\u8fd9\u5c31\u610f\u5473\u7740 canvas \u7ed8\u5236\u7684\u662f\u4e00\u4e2a\u6bd4\u4f8b\u56fe\u3002\u5177\u4f53\u663e\u793a\u7684\u5927\u5c0f\u76f4\u63a5\u628a\u8fd4\u56de\u7684\u56fe\u7247\u8def\u5f84\u653e\u7f6e\u5230 image \u6807\u7b7e\u4e2d\u5373\u53ef\u3002 \u5f53\u524d\u53ef\u4ee5\u7ed8\u52363\u79cd\u7c7b\u578b\u7684\u914d\u7f6e: image\u3001text\u3001rect\u3002\u914d\u7f6e\u7684\u5c5e\u6027\u57fa\u672c\u4e0a\u4f7f\u7528\u7684\u90fd\u662f [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[19],"tags":[],"class_list":["post-33268","post","type-post","status-publish","format-standard","hentry","category-19"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/33268","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=33268"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/33268\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=33268"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=33268"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=33268"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}