{"id":31899,"date":"2024-11-25T12:08:05","date_gmt":"2024-11-25T04:08:05","guid":{"rendered":"https:\/\/fwq.ai\/blog\/31899\/"},"modified":"2024-11-25T12:08:05","modified_gmt":"2024-11-25T04:08:05","slug":"%e5%be%ae%e4%bf%a1%e5%b0%8f%e7%a8%8b%e5%ba%8f%e4%b8%ad%e6%98%be%e7%a4%bahtml%e6%a0%bc%e5%bc%8f%e5%86%85%e5%ae%b9%e7%9a%84%e6%96%b9%e6%b3%95","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/31899\/","title":{"rendered":"\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u4e2d\u663e\u793ahtml\u683c\u5f0f\u5185\u5bb9\u7684\u65b9\u6cd5"},"content":{"rendered":"<p>\u8fd9\u7bc7\u6587\u7ae0\u4e3b\u8981\u4ecb\u7ecd\u4e86\u5173\u4e8e\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u4e2d\u663e\u793ahtml\u683c\u5f0f\u5185\u5bb9\u7684\u65b9\u6cd5\uff0c\u6709\u7740\u4e00\u5b9a\u7684\u53c2\u8003\u4ef7\u503c\uff0c\u73b0\u5728\u5206\u4eab\u7ed9\u5927\u5bb6\uff0c\u6709\u9700\u8981\u7684\u670b\u53cb\u53ef\u4ee5\u53c2\u8003\u4e00\u4e0b<\/p>\n<p>\u6700\u8fd1\u5728\u5de5\u4f5c\u4e2d\u9047\u5230\u4e00\u4e2a\u9700\u6c42\uff0c\u9700\u8981\u5728\u4e0d\u80fd\u663e\u793ahtml\u683c\u5f0f\u7684\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u4e2d\u663e\u793ahtml\u683c\u5f0f\u7684\u5185\u5bb9\uff0c\u901a\u8fc7\u67e5\u627e\u76f8\u5173\u7684\u8d44\u6599\u53d1\u73b0\u53ef\u4ee5\u5229\u7528wxParse\u6765\u5b9e\u73b0\uff0c\u4e0b\u9762\u8fd9\u7bc7\u6587\u7ae0\u5c31\u4e3b\u8981\u7ed9\u5927\u5bb6\u4ecb\u7ecd\u4e86\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u5b9e\u73b0\u663e\u793ahtml\u683c\u5f0f\u5185\u5bb9\u7684\u65b9\u6cd5\uff0c\u9700\u8981\u7684\u670b\u53cb\u53ef\u4ee5\u53c2\u8003\u501f\u9274\uff0c\u4e0b\u9762\u6765\u4e00\u8d77\u770b\u770b\u5427\u3002<\/p>\n<p><span style=\"color: #ff0000\"><strong>\u524d\u8a00<\/strong><\/span><\/p>\n<p>\u6700\u8fd1\u9879\u76ee\u4e0a\u9047\u5230\u5728\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u91cc\u9700\u8981\u663e\u793a\u65b0\u95fb\u5185\u5bb9\uff0c\u65b0\u95fb\u5185\u5bb9\u662f\u901a\u8fc7\u63a5\u53e3\u8bfb\u53d6\u7684\u670d\u52a1\u5668\u4e2d\u7684\u5bcc\u6587\u672c\u5185\u5bb9\uff0c\u662fhtml\u683c\u5f0f\u7684\uff0c\u5c0f\u7a0b\u5e8f\u9ed8\u8ba4\u662f\u4e0d\u652f\u6301html\u683c\u5f0f\u7684\u5185\u5bb9\u663e\u793a\u7684\uff0c\u90a3\u6211\u4eec\u9700\u8981\u663e\u793ahtml\u5185\u5bb9\u7684\u65f6\u5019\uff0c\u5c31\u53ef\u4ee5\u901a\u8fc7wxParse\u6765\u5b9e\u73b0\u3002<\/p>\n<p><span style=\"color: #ff0000\"><strong>\u51c6\u5907\u5de5\u4f5c\uff1a<\/strong><\/span><\/p>\n<p><span>\u7acb\u5373\u5b66\u4e60<\/span>\u201c\u201d\uff1b<\/p>\n<p><strong>\u9996\u5148\u6211\u4eec\u4e0b\u8f7dwxParse<\/strong><\/p>\n<p>github\u5730\u5740\uff1ahttps:\/\/github.com\/icindy\/wxParse<\/p>\n<p style=\"text-align: center\"><img decoding=\"async\" style=\"max-width:90%\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/009\/ebece6dba0fa578070c97c44682d85a6-0.png\" class=\"aligncenter\" title=\"\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u4e2d\u663e\u793ahtml\u683c\u5f0f\u5185\u5bb9\u7684\u65b9\u6cd5\u63d2\u56fe\" alt=\"\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u4e2d\u663e\u793ahtml\u683c\u5f0f\u5185\u5bb9\u7684\u65b9\u6cd5\u63d2\u56fe\" \/><br \/>wxParse<\/p>\n<p>\u4e0b\u8f7d\u5b8c\u4e4b\u540e\u6211\u4eec\u9700\u8981\u7528\u5230\u76ee\u5f55\u4e0b\u7684wxParse\u6587\u4ef6\u5939\uff0c\u628a\u4ed6\u62f7\u8d1d\u5230\u6211\u4eec\u7684\u9879\u76ee\u76ee\u5f55\u4e0b<\/p>\n<p style=\"text-align: center\"><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/009\/ebece6dba0fa578070c97c44682d85a6-1.png\" class=\"aligncenter\" title=\"\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u4e2d\u663e\u793ahtml\u683c\u5f0f\u5185\u5bb9\u7684\u65b9\u6cd5\u63d2\u56fe1\" alt=\"\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u4e2d\u663e\u793ahtml\u683c\u5f0f\u5185\u5bb9\u7684\u65b9\u6cd5\u63d2\u56fe1\" \/><\/p>\n<p><span style=\"color: #ff0000\"><strong>\u4e0b\u9762\u662f\u5177\u4f53\u7684\u4f7f\u7528\u6b65\u9aa4<\/strong><\/span><\/p>\n<p>1\u3001\u5728app.wxss\u5168\u5c40\u6837\u5f0f\u6587\u4ef6\u4e2d\uff0c\u9700\u8981\u5f15\u5165wxParse\u7684\u6837\u5f0f\u8868<\/p>\n<\/p>\n<pre>@import&nbsp;\"\/page\/wxParse\/wxParse.wxss\";<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>2\u3001\u5728\u9700\u8981\u52a0\u8f7dhtml\u5185\u5bb9\u7684\u9875\u9762\u5bf9\u5e94\u7684js\u6587\u4ef6\u91cc\u5f15\u5165wxParse<\/p>\n<\/p>\n<pre>var&nbsp;WxParse&nbsp;=&nbsp;require('..\/..\/wxParse\/wxParse.js');<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>3\u3001\u901a\u8fc7\u8c03\u7528WxParse.wxParse\u65b9\u6cd5\u6765\u8bbe\u7f6ehtml\u5185\u5bb9<\/p>\n<\/p>\n<pre>\/**\n*&nbsp;WxParse.wxParse(bindName&nbsp;,&nbsp;type,&nbsp;data,&nbsp;target,imagePadding)\n*&nbsp;1.bindName\u7ed1\u5b9a\u7684\u6570\u636e\u540d(\u5fc5\u586b)\n*&nbsp;2.type\u53ef\u4ee5\u4e3ahtml\u6216\u8005md(\u5fc5\u586b)\n*&nbsp;3.data\u4e3a\u4f20\u5165\u7684\u5177\u4f53\u6570\u636e(\u5fc5\u586b)\n*&nbsp;4.target\u4e3aPage\u5bf9\u8c61,\u4e00\u822c\u4e3athis(\u5fc5\u586b)\n*&nbsp;5.imagePadding\u4e3a\u5f53\u56fe\u7247\u81ea\u9002\u5e94\u662f\u5de6\u53f3\u7684\u5355\u4e00padding(\u9ed8\u8ba4\u4e3a0,\u53ef\u9009)\n*\/<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<\/p>\n<pre>Page({\n&nbsp;data:&nbsp;{\n&nbsp;},\n&nbsp;onLoad:&nbsp;function&nbsp;()&nbsp;{\n&nbsp;var&nbsp;that&nbsp;=&nbsp;this;\n&nbsp;wx.request({\n&nbsp;url:&nbsp;'',&nbsp;\n&nbsp;method:&nbsp;'POST',\n&nbsp;data:&nbsp;{\n&nbsp;'id':13\n&nbsp;},\n&nbsp;header:&nbsp;{\n&nbsp;'content-type':&nbsp;'application\/json'\n&nbsp;},\n&nbsp;success:&nbsp;function(res)&nbsp;{\n&nbsp;var&nbsp;article&nbsp;=&nbsp;res.data[0].post;\n&nbsp;WxParse.wxParse('article',&nbsp;'html',&nbsp;article,&nbsp;that,5);\n&nbsp;}\n&nbsp;})\n&nbsp;}\n})<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>4\u3001\u5728\u9875\u9762\u4e2d\u5f15\u7528\u6a21\u677f<\/p>\n<\/p>\n<pre>&lt;import&gt;&lt;\/import&gt;&lt;template&gt;&lt;\/template&gt;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u8fd9\u6837\u5c31\u53ef\u4ee5\u5728\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u4e2d\u5d4c\u5165html\u5185\u5bb9\u4e86<\/p>\n<p style=\"text-align: center\"><img decoding=\"async\" style=\"max-width:90%\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/009\/0ba21c6355b557923edc81a807d0826b-2.png\" class=\"aligncenter\" title=\"\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u4e2d\u663e\u793ahtml\u683c\u5f0f\u5185\u5bb9\u7684\u65b9\u6cd5\u63d2\u56fe2\" alt=\"\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u4e2d\u663e\u793ahtml\u683c\u5f0f\u5185\u5bb9\u7684\u65b9\u6cd5\u63d2\u56fe2\" \/><\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u672c\u6587\u7684\u5168\u90e8\u5185\u5bb9\uff0c\u5e0c\u671b\u5bf9\u5927\u5bb6\u7684\u5b66\u4e60\u6709\u6240\u5e2e\u52a9\uff0c\u66f4\u591a\u76f8\u5173\u5185\u5bb9\u8bf7\u5173\u6ce8PHP\u4e2d\u6587\u7f51\uff01<\/p>\n<p>\u76f8\u5173\u63a8\u8350\uff1a<\/p>\n<p><\/p>\n<p><\/p>\n<\/p>\n<p><span><\/span><\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u4e2d\u663e\u793ahtml\u683c\u5f0f\u5185\u5bb9\u7684\u65b9\u6cd5\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>\u8fd9\u7bc7\u6587\u7ae0\u4e3b\u8981\u4ecb\u7ecd\u4e86\u5173\u4e8e\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u4e2d\u663e\u793ahtml\u683c\u5f0f\u5185\u5bb9\u7684\u65b9\u6cd5\uff0c\u6709\u7740\u4e00\u5b9a\u7684\u53c2\u8003\u4ef7\u503c\uff0c\u73b0\u5728\u5206\u4eab\u7ed9\u5927\u5bb6\uff0c\u6709\u9700\u8981\u7684\u670b\u53cb\u53ef\u4ee5\u53c2\u8003\u4e00\u4e0b \u6700\u8fd1\u5728\u5de5\u4f5c\u4e2d\u9047\u5230\u4e00\u4e2a\u9700\u6c42\uff0c\u9700\u8981\u5728\u4e0d\u80fd\u663e\u793ahtml\u683c\u5f0f\u7684\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u4e2d\u663e\u793ahtml\u683c\u5f0f\u7684\u5185\u5bb9\uff0c\u901a\u8fc7\u67e5\u627e\u76f8\u5173\u7684\u8d44\u6599\u53d1\u73b0\u53ef\u4ee5\u5229\u7528wxParse\u6765\u5b9e\u73b0\uff0c\u4e0b\u9762\u8fd9\u7bc7\u6587\u7ae0\u5c31\u4e3b\u8981\u7ed9\u5927\u5bb6\u4ecb\u7ecd\u4e86\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u5b9e\u73b0\u663e\u793ahtml\u683c\u5f0f\u5185\u5bb9\u7684\u65b9\u6cd5\uff0c\u9700\u8981\u7684\u670b\u53cb\u53ef\u4ee5\u53c2\u8003\u501f\u9274\uff0c\u4e0b\u9762\u6765\u4e00\u8d77\u770b\u770b\u5427\u3002 \u524d\u8a00 \u6700\u8fd1\u9879\u76ee\u4e0a\u9047\u5230\u5728\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u91cc\u9700\u8981\u663e\u793a\u65b0\u95fb\u5185\u5bb9\uff0c\u65b0\u95fb\u5185\u5bb9\u662f\u901a\u8fc7\u63a5\u53e3\u8bfb\u53d6\u7684\u670d\u52a1\u5668\u4e2d\u7684\u5bcc\u6587\u672c\u5185\u5bb9\uff0c\u662fhtml\u683c\u5f0f\u7684\uff0c\u5c0f\u7a0b\u5e8f\u9ed8\u8ba4\u662f\u4e0d\u652f\u6301html\u683c\u5f0f\u7684\u5185\u5bb9\u663e\u793a\u7684\uff0c\u90a3\u6211\u4eec\u9700\u8981\u663e\u793ahtml\u5185\u5bb9\u7684\u65f6\u5019\uff0c\u5c31\u53ef\u4ee5\u901a\u8fc7wxParse\u6765\u5b9e\u73b0\u3002 \u51c6\u5907\u5de5\u4f5c\uff1a \u7acb\u5373\u5b66\u4e60\u201c\u201d\uff1b \u9996\u5148\u6211\u4eec\u4e0b\u8f7dwxParse github\u5730\u5740\uff1ahttps:\/\/github.com\/icindy\/wxParse wxParse \u4e0b\u8f7d\u5b8c\u4e4b\u540e\u6211\u4eec\u9700\u8981\u7528\u5230\u76ee\u5f55\u4e0b\u7684wxParse\u6587\u4ef6\u5939\uff0c\u628a\u4ed6\u62f7\u8d1d\u5230\u6211\u4eec\u7684\u9879\u76ee\u76ee\u5f55\u4e0b \u4e0b\u9762\u662f\u5177\u4f53\u7684\u4f7f\u7528\u6b65\u9aa4 1\u3001\u5728app.wxss\u5168\u5c40\u6837\u5f0f\u6587\u4ef6\u4e2d\uff0c\u9700\u8981\u5f15\u5165wxParse\u7684\u6837\u5f0f\u8868 @import&nbsp;&#8220;\/page\/wxParse\/wxParse.wxss&#8221;; \u767b\u5f55\u540e\u590d\u5236 2\u3001\u5728\u9700\u8981\u52a0\u8f7dhtml\u5185\u5bb9\u7684\u9875\u9762\u5bf9\u5e94\u7684js\u6587\u4ef6\u91cc\u5f15\u5165wxParse var&nbsp;WxParse&nbsp;=&nbsp;require(&#8216;..\/..\/wxParse\/wxParse.js&#8217;); \u767b\u5f55\u540e\u590d\u5236 3\u3001\u901a\u8fc7\u8c03\u7528WxParse.wxParse\u65b9\u6cd5\u6765\u8bbe\u7f6ehtml\u5185\u5bb9 \/** *&nbsp;WxParse.wxParse(bindName&nbsp;,&nbsp;type,&nbsp;data,&nbsp;target,imagePadding) *&nbsp;1.bindName\u7ed1\u5b9a\u7684\u6570\u636e\u540d(\u5fc5\u586b) *&nbsp;2.type\u53ef\u4ee5\u4e3ahtml\u6216\u8005md(\u5fc5\u586b) *&nbsp;3.data\u4e3a\u4f20\u5165\u7684\u5177\u4f53\u6570\u636e(\u5fc5\u586b) *&nbsp;4.target\u4e3aPage\u5bf9\u8c61,\u4e00\u822c\u4e3athis(\u5fc5\u586b) *&nbsp;5.imagePadding\u4e3a\u5f53\u56fe\u7247\u81ea\u9002\u5e94\u662f\u5de6\u53f3\u7684\u5355\u4e00padding(\u9ed8\u8ba4\u4e3a0,\u53ef\u9009) *\/ \u767b\u5f55\u540e\u590d\u5236 Page({ &nbsp;data:&nbsp;{ &nbsp;}, &nbsp;onLoad:&nbsp;function&nbsp;()&nbsp;{ &nbsp;var&nbsp;that&nbsp;=&nbsp;this; &nbsp;wx.request({ &nbsp;url:&nbsp;&#8221;,&nbsp; &nbsp;method:&nbsp;&#8216;POST&#8217;, &nbsp;data:&nbsp;{ &nbsp;&#8216;id&#8217;:13 &nbsp;}, &nbsp;header:&nbsp;{ &nbsp;&#8216;content-type&#8217;:&nbsp;&#8216;application\/json&#8217; &nbsp;}, &nbsp;success:&nbsp;function(res)&nbsp;{ &nbsp;var&nbsp;article&nbsp;=&nbsp;res.data[0].post; &nbsp;WxParse.wxParse(&#8216;article&#8217;,&nbsp;&#8216;html&#8217;,&nbsp;article,&nbsp;that,5); &nbsp;} &nbsp;}) &nbsp;} }) \u767b\u5f55\u540e\u590d\u5236 4\u3001\u5728\u9875\u9762\u4e2d\u5f15\u7528\u6a21\u677f &lt;import&gt;&lt;\/import&gt;&lt;template&gt;&lt;\/template&gt; \u767b\u5f55\u540e\u590d\u5236 \u8fd9\u6837\u5c31\u53ef\u4ee5\u5728\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u4e2d\u5d4c\u5165html\u5185\u5bb9\u4e86 \u4ee5\u4e0a\u5c31\u662f\u672c\u6587\u7684\u5168\u90e8\u5185\u5bb9\uff0c\u5e0c\u671b\u5bf9\u5927\u5bb6\u7684\u5b66\u4e60\u6709\u6240\u5e2e\u52a9\uff0c\u66f4\u591a\u76f8\u5173\u5185\u5bb9\u8bf7\u5173\u6ce8PHP\u4e2d\u6587\u7f51\uff01 \u76f8\u5173\u63a8\u8350\uff1a [&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-31899","post","type-post","status-publish","format-standard","hentry","category-19"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/31899","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=31899"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/31899\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=31899"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=31899"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=31899"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}