{"id":33658,"date":"2024-11-25T13:23:06","date_gmt":"2024-11-25T05:23:06","guid":{"rendered":"https:\/\/fwq.ai\/blog\/33658\/"},"modified":"2024-11-25T13:23:06","modified_gmt":"2024-11-25T05:23:06","slug":"%e5%bc%ba%e7%83%88%e6%8e%a8%e8%8d%90%e7%9a%84%e5%87%a0%e4%b8%aa%e7%ae%80%e5%8d%95%e5%8f%88%e5%ae%9e%e7%94%a8%e5%be%ae%e4%bf%a1%e5%b0%8f%e7%a8%8b%e5%ba%8f%e5%bc%80%e5%8f%91%e5%b0%8f%e6%8a%80%e5%b7%a7","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/33658\/","title":{"rendered":"\u5f3a\u70c8\u63a8\u8350\u7684\u51e0\u4e2a\u7b80\u5355\u53c8\u5b9e\u7528\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u5f00\u53d1\u5c0f\u6280\u5de7"},"content":{"rendered":"<p>\u680f\u76ee\u4eca\u5929\u5f3a\u70c8\u63a8\u4ecb\u7684\u51e0\u7b80\u5355\u53c8\u5b9e\u7528\u4e2a\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u5f00\u53d1\u5c0f\u6280\u5de7\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/052\/5f817fd30791d366.jpg\" class=\"aligncenter\" title=\"\u5f3a\u70c8\u63a8\u8350\u7684\u51e0\u4e2a\u7b80\u5355\u53c8\u5b9e\u7528\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u5f00\u53d1\u5c0f\u6280\u5de7\u63d2\u56fe\" alt=\"\u5f3a\u70c8\u63a8\u8350\u7684\u51e0\u4e2a\u7b80\u5355\u53c8\u5b9e\u7528\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u5f00\u53d1\u5c0f\u6280\u5de7\u63d2\u56fe\" \/><\/p>\n<p>\u524d\u6bb5\u65f6\u95f4\u5728\u4e0b\u5f00\u53d1\u4e86\u4e2a\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\uff0c\u5f00\u53d1\u8fc7\u7a0b\u4e2d\u603b\u7ed3\u4e86\u4e00\u4e9b\u6211\u89c9\u5f97\u5bf9\u6211\u6709\u7528\u7684\u5c0f\u6280\u5de7\uff0c\u63d0\u70bc\u51fa\u6765\uff0c\u76f8\u5f53\u4e8e\u4e00\u4e2a\u603b\u7ed3\u590d\u76d8\uff0c\u4e5f\u5e0c\u671b\u53ef\u4ee5\u5e2e\u52a9\u5230\u5927\u5bb6\u3002\u5982\u679c\u5bf9\u5927\u5bb6\u786e\u5b9e\u6709\u5e2e\u52a9\uff0c\u522b\u5fd8\u4e86\u70b9\u8d5e\u54e6&nbsp;<\/p>\n<ol>\n<li>\u5fae\u4fe1\u5f00\u53d1\u8005\u5de5\u5177\u7248\u672c\uff1a1.03.2006090\uff082020-06-19\uff09<\/li>\n<li>\u57fa\u7840\u5e93\u7248\u672c\uff1a v2.12.1 (2020-08-04)<\/li>\n<\/ol>\n<h2>1. \u5f00\u53d1\u4e2d\u53ef\u80fd\u9047\u5230\u7684\u5751\u4ee5\u53ca Tips<\/h2>\n<p>\u672c\u6765\u60f3\u5199\u4e2a\u5c0f\u6280\u5de7\u7684\uff0c\u7ed3\u679c\u6211\u603b\u7ed3\u4e86\u4e00\u5806\u5751\uff0c\u6ca1\u4e0a\u624b\u4e4b\u524d\u5b8c\u5168\u60f3\u8c61\u4e0d\u5230\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u7684\u5f00\u53d1\u4f53\u9a8c\u662f\u5982\u6b64\u4e4b\u5dee\u3001\u5982\u6b64\u4e4b\u70c2\uff0c\u4ece\u5fae\u4fe1\u5f00\u53d1\u8005\u5de5\u5177\u5230\u6240\u8c13\u7684\u300c\u5168\u65b0\u8bed\u8a00\u300d\uff0c\u90fd\u6709\u4e00\u79cd\u6d53\u6d53\u7684\u534a\u6210\u54c1\u7684 five \u5373\u89c6\u611f\uff0c\u5b9e\u5728\u8ba9\u6211 emmm&#8230;. \u53e6\u5916\u6211\u53d1\u73b0\u7f51\u4e0a\u7684\u5c0f\u7a0b\u5e8f\u6587\u7ae0\u5927\u90e8\u5206\u90fd\u662f\u5982\u4f55\u4f7f\u7528\u548c\u5982\u4f55\u907f\u5751\u7684\u5b9e\u7528\u6587\uff0c\u800c\u4e0d\u662f\u6280\u5de7\u6587\uff0c\u8fd9\u4e5f\u4ece\u4fa7\u9762\u53cd\u6620\u4e86\u5c0f\u7a0b\u5e8f\u7684\u5751\u591a\u3002<\/p>\n<p>\u5728\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u539f\u751f\u5f00\u53d1\u8fc7\u7a0b\u4e2d\uff0c\u6211\u4e0d\u65ad\u53d1\u51fa\u8fd9\u6837\u7684\u7591\u95ee\u300c\u4e3a\u4ec0\u4e48\u5802\u5802\u6280\u672f\u4eba\u624d\u591a\u5982\u725b\u6bdb\u7684\u817e\u8baf\uff0c\u4f1a\u63a8\u51fa\u5982\u6b64 laji\u300d\uff0c\u5f88\u591a\u5f31\u667a\u53cd\u4eba\u7c7b\u7684\u5730\u65b9\uff0c\u5728\u4e24\u4e09\u5e74\u524d\u793e\u533a\u5c31\u5df2\u7ecf\u63d0\u51fa\u6765\uff0c\u5b98\u65b9\u56de\u590d\u5df2\u7ecf\u53cd\u9988\u6b63\u5728\u4fee\u590d\u4e2d\uff0c\u4f46\u51e0\u5e74\u8fc7\u53bb\u4e86\uff0c\u8fd8\u662f\u6ca1\u6709\u97f3\u4fe1\uff0c\u5b98\u65b9\u56de\u590d\u4ecd\u7136\u662f\u4e00\u53e5\u51b7\u51b0\u51b0\u7684\u300c\u5df2\u53cd\u9988\u300d<\/p>\n<ol>\n<li>\u5fae\u4fe1\u5f00\u53d1\u8005\u5de5\u5177\u7ecf\u5e38\u70ed\u66f4\u65b0\u4e0d\u8d77\u4f5c\u7528\u751a\u81f3\u767d\u5c4f\uff0c\u91cd\u65b0\u7f16\u8bd1\u4e5f\u4e0d\u884c\uff0c\u53ea\u80fd\u5f3a\u884c\u9000\u51fa\u540e\u518d\u6b21\u6253\u5f00\uff1b<\/li>\n<li>\u8ddf\u4e0a\u4e00\u6761\u7c7b\u4f3c\uff0c\u6709\u65f6\u5019\u4e00\u70b9\u6837\u5f0f\u51fa\u9519\uff0c\u9884\u89c8\u6574\u4e2a\u90fd\u767d\u5c4f\uff0c\u8c03\u8bd5\u5668\u91cc\u4e5f\u4e0d\u8bf4\u54ea\u91cc\u7684\u95ee\u9898\uff0c\u76f4\u63a5\u5c31\u7ed9\u4f60\u5f03\u7597\u4e0d\u663e\u793a\uff0c\u91cd\u65b0\u7f16\u8bd1\u4e5f\u65e0\u6cd5\u89e3\u51b3\u95ee\u9898\uff0c\u53ea\u80fd\u5f3a\u884c\u9000\u51fa\u540e\u518d\u6b21\u6253\u5f00\uff1b<\/li>\n<li>\u8ddf\u4e0a\u4e00\u6761\u7c7b\u4f3c\uff0c\u8c03\u8bd5\u5668\u91cc\u62a5\u7684\u9519\u7ecf\u5e38\u6ca1\u4ec0\u4e48\u7528\uff0c\u9a74\u5934\u4e0d\u5bf9\u9a6c\u5634\uff0c\u8ba9\u4eba\u5f88\u96be\u5b9a\u4f4d\u95ee\u9898\uff1b<\/li>\n<li>Android \u7aef\u81ea\u5b9a\u4e49 Tabbar \u5728\u4e0b\u62c9\u5237\u65b0\u7684\u65f6\u5019\uff0c\u4e5f\u4f1a\u8ddf\u7740\u5c4f\u5e55\u4e00\u8d77\u5f80\u4e0b\u79fb\uff0c\u800c\u4e14\u662f\u65e0\u6cd5\u7ed5\u8fc7\u7684 Bug\uff0c\u81ea\u5b9a\u4e49 Tabbar \u6837\u5f0f\u90fd\u5199\u597d\u4e86\u7684\u6211\u53c8\u6539\u6210\u81ea\u5e26\u7684 Tabbar \u4e86\uff01<\/li>\n<li>import \u7684\u8def\u5f84\u4e0d\u652f\u6301\u7edd\u5bf9\u8def\u5f84\uff0c\u6bd4\u5982\u4f60\u5e0c\u671b\u5f15\u7528 utils\/fetch.js\uff0c\u5728\u4e0d\u7ba1\u591a\u6df1\u7684\u7ec4\u4ef6\u91cc\u9762\u4f60\u90fd\u8981\u6162\u6162 ..\/ \u70b9\u5230\u6839\u76ee\u5f55\uff0c\u540c\u6837 .wxss \u6587\u4ef6 @import \u5bfc\u5165\u6587\u4ef6\u65f6\u4e5f\u53ea\u80fd\u4f7f\u7528\u76f8\u5bf9\u8def\u5f84\uff0c\u6240\u4ee5\u5c31\u4f1a\u51fa\u73b0 ..\/..\/..\/..\/..\/..\/utils\/fetch.js \u8fd9\u79cd\u4e1c\u897f\uff1b<\/li>\n<li>\u9759\u6001\u8d44\u6e90\u8def\u5f84\u4e0d\u80fd\u6709\u6c49\u5b57\uff0c\u6709\u6c49\u5b57\u5c31\u65e0\u6cd5\u52a0\u8f7d\uff1b<\/li>\n<li>.wxs \u6587\u4ef6\u4e0d\u652f\u6301 ES6\uff0c\u53ea\u80fd\u4f7f\u7528\u8e69\u811a\u7684 ES5 \u5199\u6cd5\uff1b<\/li>\n<li>.wxml \u4e2d\u53ea\u80fd\u5f15\u5165 .wxs \u6587\u4ef6\u4e0d\u80fd\u5f15\u5165 .js \u6587\u4ef6\uff1f\uff1f\uff1f<\/li>\n<li>\u6a21\u677f {{}} \u4e2d\u8fde\u65b9\u6cd5\u90fd\u4e0d\u80fd\u6267\u884c\uff0c\u53ea\u80fd\u5904\u7406\u7b80\u5355\u7684\u8fd0\u7b97\u5982 + &#8211; * \/\uff0c\u5982\u679c\u9047\u5230\u6570\u636e\u9700\u8981 filter \u7684\u573a\u666f\uff0c\u9700\u8981\u5728 .js \u6587\u4ef6\u4e2d\u9884\u5148\u683c\u5f0f\u5316\u597d\u518d\u4e00\u4e2a\u4e2a setData\uff0c\u6bd4\u5982\u7ecf\u5e38\u5199\u7684 [2,3,4].includes(type)\uff0c\u5c45\u7136\u90fd\u8dd1\u4e0d\u8d77\u6765\uff01<\/li>\n<li>.wxs \u6587\u4ef6\u4e2d\u65e0\u6cd5\u4f7f\u7528 Date \u5bf9\u8c61\uff0c\u6240\u4ee5\u4e0d\u80fd new Date()\uff0c\u53ea\u80fd\u4f7f\u7528\u8e69\u811a\u7684 getDate \u65b9\u6cd5\uff0c\u6b63\u5219\u4e5f\u662f\u4e00\u6837\uff0c\u751f\u6210\u6b63\u5219\u5bf9\u8c61\u9700\u8981\u4f7f\u7528 getRegExp \u51fd\u6570 getRegExp(pattern[, flags])\uff1b<\/li>\n<li>.wxs \u4e2d\u53ef\u4ee5\u8c03\u7528\u5176\u5b83 .wxs \u6587\u4ef6\uff0c\u5e76\u4e14\u53ea\u80fd require \u8c03\u7528 .wxs \u6587\u4ef6\uff0c\u5f15\u5165\u7684\u6587\u4ef6\u5fc5\u987b\u4f7f\u7528\u76f8\u5bf9\u8def\u5f84\uff1b<\/li>\n<li>setData \u8fde\u4e00\u4e2a\u5bf9\u8c61\u5408\u5e76\u90fd\u61d2\u5f97\u505a\uff0c\u5982\u679c data: {a: {b: 1, c: 1}}\uff0c\u90a3\u4e48 setData({a: {b: 2}}) \u5c31\u4f1a\u4e22\u5931 a.c \u7684\u503c\uff0c\u771f\u662f\u8ba9\u4eba\u706b\u5192\u4e09\u4e08\u554a\uff0c\u8fd8\u8981 setData({[&#8216;a.b&#8217;: 2]}) \u8fd9\u6837\u624d\u884c\uff1b<\/li>\n<li>IOS \u4e0a Date \u5bf9\u8c61\u83b7\u53d6\u4efb\u610f\u65f6\u95f4\u53c2\u6570\u6bd4\u5982 getDay\u3001getTime \u90fd\u4e3a NaN\uff0c\u662f\u56e0\u4e3a IOS \u7684 Date \u6784\u9020\u51fd\u6570\u4e0d\u652f\u6301 2018-04-26 \u8fd9\u79cd\u683c\u5f0f\u7684\u65e5\u671f\uff0c\u5fc5\u987b\u8f6c\u6362\u4e3a 2018\/04\/26 \u8fd9\u79cd\u683c\u5f0f\u624d\u4f1a\u663e\u793a\u6b63\u5e38\uff1b<\/li>\n<li>\u5f00\u53d1\u7248\u5c0f\u7a0b\u5e8f\u6709\u65f6\u5019\u8bf7\u6c42\u83ab\u540d\u5176\u5999\u53d1\u4e0d\u51fa\u53bb\uff0c\u53f3\u4e0a\u89d2\u4e09\u4e2a\u70b9 enable debug \u6253\u5f00\u300c\u5f00\u53d1\u8c03\u8bd5\u300d\u4e4b\u540e\u5c31\u83ab\u540d\u5176\u5999\u80fd\u53d1\u51fa\u53bb\u8bf7\u6c42\u4e86\uff0c\u5728\u591a\u90e8\u624b\u673a\u4e0a\u90fd\u662f\u8fd9\u6837\uff0c\u4e0d\u660e\u771f\u76f8\u3002<\/li>\n<\/ol>\n<h2>2. \u5fae\u4fe1\u8bf7\u6c42 Promise \u5316<\/h2>\n<h3>2.1 \u4f7f\u7528\u73b0\u6210\u7684\u5e93<\/h3>\n<p>\u5b89\u88c5 Promise \u5e93 wx-promise-pro\uff0c\u8bb0\u5f97\u4e00\u5b9a\u8981\u5e26 -s \u6216 &#8211;production\uff0c\u8981\u4e0d\u7136\u65e0\u6cd5\u6784\u5efa\u6210\u529f\u3002<\/p>\n<pre>npm&nbsp;i&nbsp;-S&nbsp;wx-promise-pro\u590d\u5236\u4ee3\u7801<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u7136\u540e\u5728 app.js \u4e2d\uff1a<\/p>\n<pre>import&nbsp;{&nbsp;promisifyAll&nbsp;}&nbsp;from&nbsp;'wx-promise-pro'promisifyAll()&nbsp;&nbsp;\/\/&nbsp;promisify&nbsp;all&nbsp;wx&nbsp;apiApp({&nbsp;...&nbsp;})\u590d\u5236\u4ee3\u7801<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u4e4b\u540e\u5c31\u53ef\u4ee5\u6b63\u5e38\u4f7f\u7528\u4e86\uff1a<\/p>\n<pre>wx.pro.showLoading({&nbsp;&nbsp;&nbsp;&nbsp;title:&nbsp;'\u52a0\u8f7d\u4e2d',&nbsp;&nbsp;&nbsp;&nbsp;mask:&nbsp;true})\n&nbsp;&nbsp;.then(()&nbsp;=&amp;gt;&nbsp;console.log('in&nbsp;promise&nbsp;~'))\u590d\u5236\u4ee3\u7801<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<h3>2.2 \u81ea\u5df1\u5b9e\u73b0<\/h3>\n<p>\u5176\u5b9e\u6211\u4eec\u53ef\u4ee5\u81ea\u5df1\u6765\u5b9e\u73b0\u4e00\u4e2a\u8fd9\u6837\u7684\u5e93\uff0c\u539f\u7406\u5f88\u7b80\u5355\uff0c\u4ee5\u539f\u751f API \u7684 wx.request \u4e3a\u4f8b\uff1a<\/p>\n<pre>\/\/&nbsp;\u539f\u751f&nbsp;API&nbsp;\u4f7f\u7528\u65b9\u5f0fwx.request({&nbsp;&nbsp;&nbsp;&nbsp;url:&nbsp;'',&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\/\/&nbsp;\u8bf7\u6c42\u7684&nbsp;url\n&nbsp;&nbsp;&nbsp;&nbsp;data:&nbsp;{},&nbsp;&nbsp;&nbsp;&nbsp;\/\/&nbsp;\u53c2\u6570\n&nbsp;&nbsp;&nbsp;&nbsp;method:&nbsp;'',&nbsp;&nbsp;\/\/&nbsp;post\u3001get\n&nbsp;&nbsp;&nbsp;&nbsp;success:&nbsp;res&nbsp;=&amp;gt;&nbsp;{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\/\/&nbsp;\u8bf7\u6c42\u6210\u529f\u56de\u8c03\u51fd\u6570\uff0cres\u4e3a\u56de\u8c03\u53c2\u6570\n&nbsp;&nbsp;&nbsp;&nbsp;},&nbsp;&nbsp;&nbsp;&nbsp;fail:&nbsp;res&nbsp;=&amp;gt;&nbsp;{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\/\/&nbsp;\u8bf7\u6c42\u5931\u8d25\u56de\u8c03\u51fd\u6570\uff0cres\u4e3a\u56de\u8c03\u53c2\u6570\n&nbsp;&nbsp;&nbsp;&nbsp;}\n})\u590d\u5236\u4ee3\u7801<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u5982\u679c\u6211\u4eec\u5c06\u5176 Promise \u5316\uff0c\u5e94\u8be5\u7684\u8c03\u7528\u65b9\u5f0f\u5e0c\u671b\u662f\uff1a<\/p>\n<pre>\/\/&nbsp;Promise&nbsp;\u5316\u540e\u7684\u671f\u671b\u4f7f\u7528\u65b9\u5f0fwx.pro.request({&nbsp;&nbsp;&nbsp;&nbsp;url:&nbsp;'',&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\/\/&nbsp;\u8bf7\u6c42\u7684&nbsp;url\n&nbsp;&nbsp;&nbsp;&nbsp;data:&nbsp;{},&nbsp;&nbsp;&nbsp;&nbsp;\/\/&nbsp;\u53c2\u6570\n&nbsp;&nbsp;&nbsp;&nbsp;method:&nbsp;''&nbsp;&nbsp;&nbsp;\/\/&nbsp;post\u3001get})\n&nbsp;&nbsp;.then(res&nbsp;=&amp;gt;&nbsp;{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\/\/&nbsp;\u8bf7\u6c42\u6210\u529f\u56de\u8c03\u51fd\u6570\uff0cres\u4e3a\u56de\u8c03\u53c2\u6570\n&nbsp;&nbsp;})\n&nbsp;&nbsp;.catch(res&nbsp;=&amp;gt;&nbsp;{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\/\/&nbsp;\u8bf7\u6c42\u5931\u8d25\u56de\u8c03\u51fd\u6570\uff0cres\u4e3a\u56de\u8c03\u53c2\u6570\n&nbsp;&nbsp;})\u590d\u5236\u4ee3\u7801<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u5e76\u4e14 then \u51fd\u6570\u8fd4\u56de\u7684\u662f\u4e00\u4e2a Promise \u5bf9\u8c61\uff0c\u8ba9\u8fd9\u4e2a\u51fd\u6570\u53ef\u4ee5\u4e0d\u65ad\u94fe\u5f0f\u8c03\u7528\u4e0b\u53bb\uff0c\u6240\u4ee5\u9996\u5148\u9700\u8981 new \u51fa\u6765\u4e00\u4e2a Promise \u5bf9\u8c61\uff1a<\/p>\n<pre>function&nbsp;request(opt)&nbsp;{&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;new&nbsp;Promise((resolve,&nbsp;reject)&nbsp;=&amp;gt;&nbsp;{\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;wx.request({\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;...opt,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;success:&nbsp;res&nbsp;=&amp;gt;&nbsp;{&nbsp;resolve(res)},&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fail:&nbsp;res&nbsp;=&amp;gt;&nbsp;{reject(res)}\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;})\n&nbsp;&nbsp;&nbsp;&nbsp;})\n}\u590d\u5236\u4ee3\u7801<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u8fd9\u91cc\u4ee3\u7801\u6211\u4eec\u53ef\u4ee5\u8fdb\u4e00\u6b65\u6539\u8fdb\uff0c\u7531\u4e8e success\u3001fail \u8fd9\u91cc\u4f20\u5165\u7684\u53c2\u6570\u53ea\u662f\u7531 resolve\u3001reject \u65b9\u6cd5\u6267\u884c\u4e86\u4e0b\uff0c\u6240\u4ee5\u53ef\u4ee5\u76f4\u63a5\u4f20\u5165 resolve\u3001reject \u65b9\u6cd5\u5373\u53ef\u3002<\/p>\n<p>\u53e6\u5916\uff0c\u7531\u4e8e\u5176\u4ed6\u5c0f\u7a0b\u5e8f\u539f\u751f API \u683c\u5f0f\u4e00\u81f4\uff0c\u6240\u4ee5\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528\u67ef\u91cc\u5316\u65b9\u6cd5\uff0c\u6765\u5c06\u5176\u4ed6\u9700\u8981\u8fdb\u884c Promise \u5316\u7684 API \u8fdb\u884c\u5904\u7406\uff1a<\/p>\n<pre>function&nbsp;promisify(api)&nbsp;{&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;(opt&nbsp;=&nbsp;{})&nbsp;=&amp;gt;&nbsp;{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;new&nbsp;Promise((resolve,&nbsp;reject)&nbsp;=&amp;gt;&nbsp;{\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;api({\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;...opt,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fail:&nbsp;reject,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;success:&nbsp;resolve\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;})\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;})\n&nbsp;&nbsp;&nbsp;&nbsp;}\n}\u590d\u5236\u4ee3\u7801<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u7136\u540e\uff0c\u5c06\u67ef\u91cc\u5316\u65b9\u6cd5\u6267\u884c\u7684\u7ed3\u679c\u4f5c\u4e3a\u65b0\u7684 Promise \u5316\u7684 API \u6302\u8f7d\u5230 wx.pro \u5bf9\u8c61\u4e0a\uff1a<\/p>\n<pre>\/\/&nbsp;\u5c06\u6307\u5b9a&nbsp;API&nbsp;\u8fdb\u884c&nbsp;Promise&nbsp;\u5316wx.pro.request&nbsp;=&nbsp;promisify(wx.request)\/\/&nbsp;\u4f7f\u7528wx.pro.request({...})\n&nbsp;&nbsp;&nbsp;&nbsp;.then(...)\u590d\u5236\u4ee3\u7801<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u7136\u540e\u4e3a\u4e86\u65b9\u4fbf\u6211\u4eec\u4f7f\u7528\u5176\u4ed6\u65b9\u6cd5\uff0c\u53ef\u4ee5\u5faa\u73af\u5c06 wx \u5bf9\u8c61\u4e0a\u53ef\u4ee5\u88ab Promise \u5316\u7684\u65b9\u6cd5\u6bd4\u5982 request\u3001scanCode\u3001showToast\u3001getUserInfo \u7b49\u4e00\u4e00\u6302\u8f7d\u5230 wx.pro \u5bf9\u8c61\u4e0a\uff0c\u4f7f\u7528\u65f6\u53ef\u4ee5\u76f4\u63a5 wx.pro.xx\uff0c\u7531\u4e8e\u8fd9\u4e2a\u65b9\u6cd5\u6267\u884c\u8fd4\u56de\u7684\u662f\u4e00\u4e2a Promise \u5bf9\u8c61\uff0c\u56e0\u6b64\u53ef\u4ee5\u50cf\u5176\u5b83 Promise \u5316\u7684\u5bf9\u8c61\u90a3\u6837\u4f7f\u7528\u3002<\/p>\n<p>\u4e8b\u5b9e\u4e0a\uff0c\u4e0d\u77e5\u4e0d\u89c9\uff0c\u6211\u4eec\u5c31\u81ea\u5df1\u5b9e\u73b0\u4e86 wx-promise-pro \u7684\u6e90\u7801\uff0c\u8fd9\u4e2a\u5e93\u7684\u6838\u5fc3\u4ee3\u7801\u4e5f\u5c31\u662f\u4e0a\u9762\u90a3\u8fd9\u51e0\u884c&nbsp;<\/p>\n<h3>2.3 \u5728\u9879\u76ee\u4e2d\u4f7f\u7528<\/h3>\n<p>\u6709\u4e86\u4e0a\u9762\u7684\u5de5\u5177\u540e\uff0c\u6211\u4eec\u53ef\u4ee5\u5c06\u5176\u4f7f\u7528\u5728\u9879\u76ee\u4e2d\uff0c\u4e3a\u4e86\u4e0d\u5728\u9879\u76ee\u4e2d\u904d\u5e03 wx.request \u6216 wx.pro.request \u8fd9\u91cc\u53ef\u4ee5\u7b80\u5355\u8fdb\u884c\u5c01\u88c5\uff0c\u65b0\u5efa\u4e24\u4e2a\u6587\u4ef6\u5982\u4e0b\uff1a<\/p>\n<pre>\/\/&nbsp;utils\/api\/fetch.js&nbsp;\u5c01\u88c5\u8bf7\u6c42\u65b9\u6cd5\u3001\u8bf7\u6c42\u62e6\u622a\u5668const&nbsp;app&nbsp;=&nbsp;getApp()const&nbsp;BaseUrl&nbsp;=&nbsp;'http:\/\/172.0.0.1:7300\/mock'const&nbsp;TokenWhiteList&nbsp;=&nbsp;[&nbsp;&nbsp;&nbsp;&nbsp;'\/app\/user\/get-by-code'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\/\/&nbsp;\u4e0d\u9700\u8981\u9274\u6743\u7684api\u624b\u52a8\u6dfb\u52a0\u5230\u8fd9\u91cc]\/**\n&nbsp;*&nbsp;\u8bbe\u7f6e\u8bf7\u6c42\u62e6\u622a\u5668\n&nbsp;*&nbsp;@param&nbsp;params&nbsp;\u8bf7\u6c42\u53c2\u6570\n&nbsp;*\/const&nbsp;fetch&nbsp;=&nbsp;(params&nbsp;=&nbsp;{})&nbsp;=&amp;gt;&nbsp;{&nbsp;&nbsp;&nbsp;&nbsp;\/\/&nbsp;\u62e6\u622a\u5668\u903b\u8f91\n&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(!TokenWhiteList.includes(params.url))&nbsp;{\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;params.header&nbsp;=&nbsp;{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'content-type':&nbsp;'application\/json',&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\/\/&nbsp;\u9ed8\u8ba4\u503c\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'token':&nbsp;app.globalData.token&nbsp;||&nbsp;''\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}\n&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(params.url.startsWith('\/'))&nbsp;{&nbsp;&nbsp;&nbsp;&nbsp;\/\/&nbsp;\u62fc\u63a5\u5b8c\u6574URL\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;params.url&nbsp;=&nbsp;BaseUrl&nbsp;+&nbsp;params.url\n&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;&nbsp;&nbsp;\/\/&nbsp;\u8fd4\u56depromise\n&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;wx.pro.request({&nbsp;...params&nbsp;})\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.then(({&nbsp;data:&nbsp;{&nbsp;code,&nbsp;message,&nbsp;data&nbsp;}&nbsp;})&nbsp;=&amp;gt;&nbsp;{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\/\/&nbsp;...&nbsp;\u5404\u79cd\u5f02\u5e38\u60c5\u51b5\u7684\u903b\u8f91\u5904\u7406\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\/\/&nbsp;\u4e0e\u540e\u7aef\u7ea6\u5b9a&nbsp;code&nbsp;20000&nbsp;\u65f6\u6b63\u5e38\u8fd4\u56de\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(code&nbsp;===&nbsp;20000)&nbsp;return&nbsp;Promise.resolve(data)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;Promise.reject(message)\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;})\n}export&nbsp;{&nbsp;fetch&nbsp;}\u590d\u5236\u4ee3\u7801<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u7136\u540e\u518d\u5c06\u6240\u6709 API \u5c01\u88c5\u5230\u5355\u72ec\u7684\u6587\u4ef6\u4e2d\u96c6\u4e2d\u7ba1\u7406\uff1a<\/p>\n<pre>\/\/&nbsp;utils\/api\/apis.js&nbsp;\u5c01\u88c5\u6240\u6709\u8bf7\u6c42&nbsp;APIimport&nbsp;{&nbsp;fetch&nbsp;}&nbsp;from&nbsp;'.\/fetch'\/*&nbsp;\u6839\u636e\u5fae\u4fe1code\u83b7\u53d6\u7528\u6237\u4fe1\u606f&nbsp;*\/const&nbsp;appUserGetByCode&nbsp;=&nbsp;({&nbsp;code&nbsp;}&nbsp;=&nbsp;{})&nbsp;=&amp;gt;&nbsp;fetch({&nbsp;&nbsp;&nbsp;&nbsp;url:&nbsp;'\/app\/user\/get-by-code',&nbsp;&nbsp;&nbsp;&nbsp;data:&nbsp;{&nbsp;code&nbsp;}\n})\/*&nbsp;\u626b\u7801\u767b\u5f55&nbsp;*\/const&nbsp;appUserQrLogin&nbsp;=&nbsp;({&nbsp;qrCode&nbsp;}&nbsp;=&nbsp;{})&nbsp;=&amp;gt;&nbsp;fetch({&nbsp;&nbsp;&nbsp;&nbsp;method:&nbsp;'POST',&nbsp;&nbsp;&nbsp;&nbsp;url:&nbsp;'\/app\/user\/qr-login',&nbsp;&nbsp;&nbsp;&nbsp;data:&nbsp;{&nbsp;qrCode&nbsp;}\n})\/*&nbsp;\u4e2a\u4eba\u4fe1\u606f&nbsp;*\/const&nbsp;appUserInfo&nbsp;=&nbsp;()&nbsp;=&amp;gt;&nbsp;fetch({&nbsp;&nbsp;&nbsp;&nbsp;url:&nbsp;'\/app\/user\/info'})\/*&nbsp;\u7cfb\u7edf\u53c2\u6570\u83b7\u53d6\uff0c\u6570\u636e\u5b57\u5178&nbsp;*\/const&nbsp;appSysParamListByParam&nbsp;=&nbsp;()&nbsp;=&amp;gt;&nbsp;fetch({&nbsp;&nbsp;&nbsp;&nbsp;url:&nbsp;'\/app\/sys-param\/list-by-param'})\/*&nbsp;\u6570\u636e\u5b57\u5178\u6240\u6709&nbsp;*\/const&nbsp;appSysParamListAll&nbsp;=&nbsp;()&nbsp;=&amp;gt;&nbsp;fetch({&nbsp;&nbsp;&nbsp;&nbsp;url:&nbsp;'\/app\/sys-param\/list-all'})export&nbsp;{\n&nbsp;&nbsp;&nbsp;&nbsp;appSysParamListAll,&nbsp;&nbsp;&nbsp;\/\/&nbsp;\u6570\u636e\u5b57\u5178\u6240\u6709\n&nbsp;&nbsp;&nbsp;&nbsp;appSysParamListByParam,&nbsp;&nbsp;&nbsp;\/\/&nbsp;\u7cfb\u7edf\u53c2\u6570\u83b7\u53d6\uff0c\u6570\u636e\u5b57\u5178\n&nbsp;&nbsp;&nbsp;&nbsp;appUserGetByCode,&nbsp;&nbsp;&nbsp;\/\/&nbsp;\u6839\u636e\u5fae\u4fe1code\u83b7\u53d6\u7528\u6237\u4fe1\u606f\n&nbsp;&nbsp;&nbsp;&nbsp;appUserQrLogin,&nbsp;&nbsp;&nbsp;\/\/&nbsp;\u626b\u7801\u767b\u5f55\n&nbsp;&nbsp;&nbsp;&nbsp;appUserInfo&nbsp;&nbsp;&nbsp;\/\/&nbsp;\u4e2a\u4eba\u4fe1\u606f}\u590d\u5236\u4ee3\u7801<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u5728\u8981\u4f7f\u7528 API \u7684\u5730\u65b9\u5c31\u53ef\u4ee5\u8fd9\u6837\u5f15\u5165\uff1a<\/p>\n<pre>import&nbsp;*&nbsp;as&nbsp;Api&nbsp;from&nbsp;'..\/..\/utils\/api\/apis.js'&nbsp;&nbsp;&nbsp;\/\/&nbsp;\u76f8\u5bf9\u8def\u5f84\/\/&nbsp;\u4f7f\u7528\u65b9\u5f0fApi.appSysParamListAll()\n&nbsp;&nbsp;.then(({&nbsp;dataList&nbsp;})&nbsp;=&amp;gt;&nbsp;this.upData({&nbsp;sysParamList:&nbsp;dataList&nbsp;}))\n&nbsp;&nbsp;.then(()&nbsp;=&amp;gt;&nbsp;{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;const&nbsp;keyList&nbsp;=&nbsp;this.data.sysParamList.map(T&nbsp;=&amp;gt;&nbsp;T.key)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;this.upData({\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;keyList,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;formData:&nbsp;{&nbsp;keys:&nbsp;keyList&nbsp;}\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;})\n&nbsp;&nbsp;})\u590d\u5236\u4ee3\u7801<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u4f7f\u7528\u65b9\u5f0f\u5c31\u5f88\u8212\u670d\uff0c\u8fd9\u91cc\u4f7f\u7528\u5230\u4e86 upData\uff0c\u5c31\u662f\u4e0b\u9762\u6211\u8981\u4ecb\u7ecd\u7684\u5185\u5bb9\uff0c\u662f\u5728\u4e0b\u975e\u5e38\u63a8\u4ecb\u7684\u5c0f\u7a0b\u5e8f\u5de5\u5177\uff5e&nbsp;<\/p>\n<h2>3. setState \u4fee\u6539 data \u4e2d\u60f3\u4fee\u6539\u5bf9\u8c61\u7684\u5c5e\u6027<\/h2>\n<p>\u5728\u5c0f\u7a0b\u5e8f\u4e2d\uff0cdata \u662f\u4e0d\u80fd\u76f4\u63a5\u64cd\u4f5c\u7684\uff0c\u9700\u8981\u4f7f\u7528 setData \u51fd\u6570\u3002\u9274\u4e8e\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u5f00\u53d1\u65f6 setData \u7684\u4f7f\u7528\u4f53\u9a8c\u5341\u5206\u8e69\u811a\uff0c\u6211\u4f7f\u7528\u4e86\u4e2a\u5e93\u51fd\u6570 wx-updata\uff0c\u8fd9\u4e2a\u5e93\u51fd\u6570\u5728\u5f00\u53d1\u7684\u65f6\u5019\u5bf9\u6211\u5f88\u6709\u5e2e\u52a9\uff0c\u8fd9\u91cc\u7279\u610f\u63a8\u4ecb\u7ed9\u5927\u5bb6\u3002<\/p>\n<h3>3.1 \u4e3a\u4ec0\u4e48\u8981\u4f7f\u7528 wx-updata<\/h3>\n<p>\u4f60\u5728\u4f7f\u7528 setData \u7684\u65f6\u5019\uff0c\u662f\u4e0d\u662f\u6709\u65f6\u5019\u89c9\u5f97\u5f88\u96be\u53d7\uff0c\u4e3e\u4e2a\u7b80\u5355\u7684\u4f8b\u5b50\uff1a<\/p>\n<pre>\/\/&nbsp;\u4f60\u7684&nbsp;datadata:&nbsp;{&nbsp;&nbsp;&nbsp;&nbsp;name:&nbsp;'\u8721\u7b14\u5c0f\u65b0',&nbsp;&nbsp;&nbsp;&nbsp;info:&nbsp;{&nbsp;height:&nbsp;140,&nbsp;color:&nbsp;'\u9ec4\u8272'&nbsp;}\n}\u590d\u5236\u4ee3\u7801<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u5982\u679c\u8981\u4fee\u6539 info.height \u4e3a 155\uff0c\u4f7f\u7528 setData \u8981\u600e\u4e48\u505a\u5462\uff1a<\/p>\n<pre>\/\/&nbsp;\u8fd9\u6837\u4f1a\u628a&nbsp;info&nbsp;\u91cc\u5176\u4ed6\u5c5e\u6027\u6574\u4e0d\u89c1\u4e86this.setData({&nbsp;info:&nbsp;{&nbsp;height:&nbsp;155&nbsp;}&nbsp;})\/\/&nbsp;\u4f60\u9700\u8981\u53d6\u51fa&nbsp;info&nbsp;\u5bf9\u8c61\uff0c\u4fee\u6539\u540e\u6574\u4e2a&nbsp;setDataconst&nbsp;{&nbsp;info&nbsp;}&nbsp;=&nbsp;this.data\ninfo.height&nbsp;=&nbsp;155this.setData({&nbsp;info&nbsp;})\u590d\u5236\u4ee3\u7801<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u4f3c\u4e4e\u5e76\u4e0d\u592a\u590d\u6742\uff0c\u4f46\u5982\u679c data \u662f\u4e2a\u5f88\u5927\u7684\u5bf9\u8c61\uff0c\u8981\u628a\u6bd4\u8f83\u6df1\u4e14\u4e0d\u540c\u7684\u5bf9\u8c61\u3001\u6570\u7ec4\u9879\u6328\u4e2a\u6539\u53d8\uff1a<\/p>\n<pre>data:&nbsp;{&nbsp;&nbsp;&nbsp;&nbsp;name:&nbsp;'\u8721\u7b14\u5c0f\u65b0',&nbsp;&nbsp;&nbsp;&nbsp;info:&nbsp;{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;height:&nbsp;140,&nbsp;color:&nbsp;'\u9ec4\u8272',&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;desc:&nbsp;[{&nbsp;age:&nbsp;8&nbsp;},&nbsp;'\u6700\u559c\u6b22\u5927\u8c61\u4e4b\u6b4c',&nbsp;'\u9753\u4ed4',&nbsp;{&nbsp;dog:&nbsp;'\u5c0f\u767d',&nbsp;color:&nbsp;'\u767d\u8272'&nbsp;}]\n&nbsp;&nbsp;&nbsp;&nbsp;}\n}\u590d\u5236\u4ee3\u7801<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u6bd4\u5982\u67d0\u4e2a\u9700\u6c42\uff0c\u9700\u8981\u628a info.height \u6539\u4e3a 155\uff0c\u540c\u65f6\u6539\u53d8 info.desc \u6570\u7ec4\u7684\u7b2c 0 \u9879\u7684 age \u4e3a 12\uff0c\u7b2c 3 \u9879\u7684 color \u4e3a\u7070\u8272\u5462\uff1f<\/p>\n<pre>\/\/&nbsp;\u5148\u53d6\u51fa\u8981\u6539\u53d8\u7684\u5bf9\u8c61\uff0c\u6539\u53d8\u6570\u5b57\u540e&nbsp;setData&nbsp;\u56de\u53bbconst&nbsp;{&nbsp;info&nbsp;}&nbsp;=&nbsp;this.data\ninfo.height&nbsp;=&nbsp;155info.desc[0].age&nbsp;=&nbsp;12info.desc[3].color&nbsp;=&nbsp;'\u7070\u8272'this.setData({&nbsp;info&nbsp;})\/\/&nbsp;\u6216\u8005\u50cf\u67d0\u4e9b\u6587\u7ae0\u91cc\u4ecb\u7ecd\u7684\uff0c\u8fd9\u6837\u53ef\u8bfb\u6027\u5dee\uff0c\u4e5f\u4e0d\u592a\u5b9e\u7528this.setData({&nbsp;&nbsp;&nbsp;&nbsp;'info.height':&nbsp;155,&nbsp;&nbsp;&nbsp;&nbsp;'info.desc[0].age':&nbsp;12,&nbsp;&nbsp;&nbsp;&nbsp;'info.desc[3].color':&nbsp;'\u7070\u8272'})\u590d\u5236\u4ee3\u7801<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u4e0a\u9762\u8fd9\u4e24\u79cd\u65b9\u6cd5\uff0c\u662f\u6211\u4eec\u5e73\u5e38\u5c0f\u7a0b\u5e8f\u91cc\u7ecf\u5e38\u7528\u7684\uff0c\u548c\u5176\u4ed6 Web \u7aef\u7684\u6846\u67b6\u76f8\u6bd4\uff0c\u5c31\u5f88\u8e69\u811a\uff0c\u4e00\u79cd\u6d53\u6d53\u7684\u534a\u6210\u54c1\u611f\u6251\u9762\u800c\u6765\uff0c\u6709\u6ca1\u6709\u8fd9\u6837\u4e00\u4e2a\u65b9\u6cd5\uff1a<\/p>\n<pre>this.upData({&nbsp;&nbsp;&nbsp;&nbsp;info:&nbsp;{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;height:&nbsp;155,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;desc:&nbsp;[{&nbsp;age:&nbsp;12&nbsp;},&nbsp;,&nbsp;,&nbsp;{&nbsp;color:&nbsp;'\u7070\u8272'&nbsp;}]\n&nbsp;&nbsp;&nbsp;&nbsp;}\n})\u590d\u5236\u4ee3\u7801<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u8fd9\u4e2a\u65b9\u6cd5\u4f1a\u5e2e\u6211\u4eec\u6df1\u5ea6\u6539\u53d8\u5d4c\u5957\u5bf9\u8c61\u91cc\u5bf9\u5e94\u7684\u5c5e\u6027\u503c\uff0c\u8df3\u8fc7\u6570\u7ec4\u9879\u91cc\u4e0d\u60f3\u6539\u53d8\u7684\uff0c\u53ea\u8bbe\u7f6e\u6211\u4eec\u63d0\u4f9b\u4e86\u7684\u5c5e\u6027\u503c\u3001\u6570\u7ec4\u9879\uff0c\u5c82\u4e0d\u662f\u7701\u7565\u4e86\u4e00\u5927\u5806\u8e69\u811a\u7684\u4ee3\u7801\uff0c\u800c\u4e14\u53ef\u8bfb\u6027\u4e5f\u6781\u4f73\u5462\u3002<\/p>\n<p>\u8fd9\u5c31\u662f\u4e3a\u4ec0\u4e48\u6211\u5728\u4e0a\u7ebf\u7684\u9879\u76ee\u4e2d\u4f7f\u7528 wx-updata\uff0c\u800c\u4e0d\u662f setData<\/p>\n<p>wx-updata \u7684\u539f\u7406\u5176\u5b9e\u5f88\u7b80\u5355\uff0c\u4e3e\u4e2a\u4f8b\u5b50\uff1a<\/p>\n<pre>this.upData({&nbsp;&nbsp;&nbsp;&nbsp;info:&nbsp;{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;height:&nbsp;155,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;desc:&nbsp;[{&nbsp;age:&nbsp;12&nbsp;}]\n&nbsp;&nbsp;&nbsp;&nbsp;}\n})\/\/&nbsp;\u4f1a\u88ab\u81ea\u52a8\u8f6c\u5316\u4e3a\u4e0b\u9762\u8fd9\u79cd\u683c\u5f0f\uff0c\/\/&nbsp;this.setData({\/\/&nbsp;&nbsp;&nbsp;&nbsp;'info.height':&nbsp;155,\/\/&nbsp;&nbsp;&nbsp;&nbsp;'info.desc[0].age':&nbsp;12,\/\/&nbsp;})\u590d\u5236\u4ee3\u7801<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u539f\u6765\u8fd9\u4e2a\u8f6c\u5316\u5de5\u4f5c\u662f\u8981\u6211\u4eec\u81ea\u5df1\u624b\u52a8\u6765\u505a\uff0c\u73b0\u5728 wx-updata \u5e2e\u6211\u4eec\u505a\u4e86\uff0c\u5c82\u4e0d\u7f8e\u54c9\uff01<\/p>\n<h3>3.2 wx-updata \u4f7f\u7528\u65b9\u5f0f<\/h3>\n<p>\u5728\u4e00\u822c\u60c5\u51b5\u4e0b\uff0c\u6211\u4eec\u53ef\u4ee5\u5c06\u65b9\u6cd5\u76f4\u63a5\u6302\u8f7d\u5230 Page \u6784\u9020\u51fd\u6570\u4e0a\uff0c\u8fd9\u6837\u5c31\u53ef\u4ee5\u5728 Page \u5b9e\u4f8b\u4e2d\u50cf\u4f7f\u7528 setData \u4e00\u6837\u4f7f\u7528 upData \u4e86\uff1a<\/p>\n<pre>\/\/&nbsp;app.js&nbsp;\u4e2d\u6302\u8f7dimport&nbsp;{&nbsp;updataInit&nbsp;}&nbsp;from&nbsp;'.\/miniprogram_npm\/wx-updata\/index'&nbsp;&nbsp;\/\/&nbsp;\u4f60\u7684\u5e93\u6587\u4ef6\u8def\u5f84App({\n&nbsp;&nbsp;&nbsp;&nbsp;onLaunch()&nbsp;{\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Page&nbsp;=&nbsp;updataInit(Page,&nbsp;{&nbsp;debug:&nbsp;true&nbsp;})\n&nbsp;&nbsp;&nbsp;&nbsp;}\n})\/\/&nbsp;\u9875\u9762\u4ee3\u7801\u4e2d\u4f7f\u7528\u65b9\u5f0fthis.upData({&nbsp;&nbsp;&nbsp;&nbsp;info:&nbsp;{&nbsp;height:&nbsp;155&nbsp;},&nbsp;&nbsp;&nbsp;&nbsp;desc:&nbsp;[{&nbsp;age:&nbsp;13&nbsp;},&nbsp;'\u5e05\u54e5'],&nbsp;&nbsp;&nbsp;&nbsp;family:&nbsp;[,&nbsp;,&nbsp;[,&nbsp;,&nbsp;,&nbsp;{&nbsp;color:&nbsp;'\u7070\u8272'&nbsp;}]]\n})\u590d\u5236\u4ee3\u7801<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u6709\u7684\u6846\u67b6\u53ef\u80fd\u5728 Page \u5bf9\u8c61\u4e0a\u8fdb\u884c\u4e86\u8fdb\u4e00\u6b65\u4fee\u6539\uff0c\u76f4\u63a5\u66ff\u6362 Page \u7684\u65b9\u5f0f\u53ef\u80fd\u5c31\u4e0d\u592a\u597d\u4e86\uff0cwx-updata \u540c\u6837\u66b4\u9732\u4e86\u5de5\u5177\u65b9\u6cd5\uff0c\u7528\u6237\u53ef\u4ee5\u5728\u9875\u9762\u4ee3\u7801\u4e2d\u76f4\u63a5\u4f7f\u7528\u5de5\u5177\u65b9\u6cd5\u8fdb\u884c\u5904\u7406\uff1a<\/p>\n<pre>\/\/&nbsp;\u9875\u9762\u4ee3\u7801\u4e2dimport&nbsp;{&nbsp;objToPath&nbsp;}&nbsp;from&nbsp;'.\/miniprogram_npm\/wx-updata\/index'&nbsp;&nbsp;\/\/&nbsp;\u4f60\u7684\u5e93\u6587\u4ef6\u8def\u5f84Page({&nbsp;&nbsp;&nbsp;&nbsp;data:&nbsp;{&nbsp;a:&nbsp;{&nbsp;b:&nbsp;2},&nbsp;c:&nbsp;[3,4,5]},&nbsp;&nbsp;&nbsp;&nbsp;\/\/&nbsp;\u81ea\u5df1\u5c01\u88c5\u4e00\u4e0b\n&nbsp;&nbsp;&nbsp;&nbsp;upData(data)&nbsp;{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;this.setData(objToPath(data))\n&nbsp;&nbsp;&nbsp;&nbsp;},&nbsp;&nbsp;&nbsp;&nbsp;\/\/&nbsp;\u4f60\u7684\u65b9\u6cd5\u4e2d\u6216\u751f\u547d\u5468\u671f\u51fd\u6570\n&nbsp;&nbsp;&nbsp;&nbsp;yourMethod()&nbsp;{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;this.upData({&nbsp;a:&nbsp;{&nbsp;b:&nbsp;7},&nbsp;c:&nbsp;[8,,9]})\n&nbsp;&nbsp;&nbsp;&nbsp;}\n})\u590d\u5236\u4ee3\u7801<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u9488\u5bf9\u4fee\u6539\u6570\u7ec4\u6307\u5b9a\u9879\u7684\u65f6\u5019\uff0c\u53ef\u80fd\u5b58\u5728\u7684\u8df3\u8fc7\u6570\u7ec4\u7a7a\u4f4d\u7684\u60c5\u51b5\uff0cwx-updata \u63d0\u4f9b\u4e86 Empty \u7684 Symbol \u7c7b\u578b\u66ff\u4f4d\u7b26\uff0c\u8fd8\u6709\u6570\u7ec4\u7684\u5bf9\u8c61\u8def\u5f84\u65b9\u5f0f\uff0c\u611f\u5174\u8da3\u53ef\u4ee5\u770b\u770b wx-updata \u7684\u6587\u6863\uff0c\u4e5f\u53ef\u4ee5\u53c2\u8003 \u8fd9\u7bc7\u4ecb\u7ecd\u6587\u7ae0\u3002<\/p>\n<p>\u53e6\u5916\uff0c\u4f7f\u7528\u4e86 wx-updata \u4e5f\u8fd8\u53ef\u4ee5\u4f7f\u7528\u539f\u6765\u7684 setData\uff0c\u7279\u522b\u662f\u6709\u65f6\u5019\u8981\u6e05\u7a7a\u6570\u7ec4\u65f6\uff0c\u7075\u6d3b\u4f7f\u7528\uff0c\u53ef\u4ee5\u83b7\u5f97\u66f4\u597d\u7684\u5c0f\u7a0b\u5e8f\u5f00\u53d1\u4f53\u9a8c\uff0c\u795d\u5927\u5bb6\u5c0f\u7a0b\u5e8f\u5f00\u53d1\u6109\u5feb&nbsp;<\/p>\n<h2>4. \u4f7f\u7528 scss \u5199\u6837\u5f0f<\/h2>\n<h3>4.1 Webstorm \u914d\u7f6e\u65b9\u6cd5<\/h3>\n<p>\u5173\u4e8e\u8e69\u811a\u7684 .wxss \u6837\u5f0f\uff0c\u6211\u4f7f\u7528 webstorm \u7684 file watcher \u5de5\u5177\u628a scss \u6587\u4ef6\u76d1\u542c\u6539\u52a8\u5e76\u5b9e\u65f6\u7f16\u8bd1\u6210 .wxss \u6587\u4ef6\uff0c\u611f\u89c9\u6bd4\u8f83\u597d\u7528\uff0c\u8fd9\u91cc\u7ed9\u5927\u5bb6\u5206\u4eab\u4e00\u4e0b\u6211\u7684\u914d\u7f6e\uff1a<\/p>\n<p><img decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/052\/315ef60473da8fca8cd9e7ec6866fd80-0.png\" style=\"max-width:90%\" title=\"\u5f3a\u70c8\u63a8\u8350\u7684\u51e0\u4e2a\u7b80\u5355\u53c8\u5b9e\u7528\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u5f00\u53d1\u5c0f\u6280\u5de7\u63d2\u56fe1\" alt=\"\u5f3a\u70c8\u63a8\u8350\u7684\u51e0\u4e2a\u7b80\u5355\u53c8\u5b9e\u7528\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u5f00\u53d1\u5c0f\u6280\u5de7\u63d2\u56fe1\" \/><\/p>\n<p>\u7136\u540e\u8bb0\u5f97\u5728 .gitignore \u6587\u4ef6\u4e2d\u52a0\u5165\u8981\u5ffd\u7565\u7684\u6837\u5f0f\uff1a<\/p>\n<pre>*.scss\n*.wxss.map\u590d\u5236\u4ee3\u7801<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u8fd9\u6837\u5728\u4e0a\u4f20\u5230 git \u7684\u65f6\u5019\uff0c\u5c31\u4e0d\u4f1a\u4e0a\u4f20 scss \u6587\u4ef6\u4e86\uff5e \u5f53\u7136\u5982\u679c\u4f60\u7684\u56e2\u961f\u6210\u5458\u9700\u8981 scss \u7684\u8bdd\uff0c\u8fd8\u662f\u5efa\u8bae git \u4e0a\u4f20\u7684\u65f6\u5019\u4e5f\u52a0\u4e0a scss \u6587\u4ef6\u3002<\/p>\n<p>\u8fd9\u6837\u8bbe\u7f6e\u4e4b\u540e\uff0c\u4e00\u4e2a\u7ec4\u4ef6\u5728\u672c\u5730\u7684\u4f1a\u662f\u4e0b\u9762\u8fd9\u6837<\/p>\n<p><img decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/052\/315ef60473da8fca8cd9e7ec6866fd80-1.png\" style=\"max-width:90%\" title=\"\u5f3a\u70c8\u63a8\u8350\u7684\u51e0\u4e2a\u7b80\u5355\u53c8\u5b9e\u7528\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u5f00\u53d1\u5c0f\u6280\u5de7\u63d2\u56fe2\" alt=\"\u5f3a\u70c8\u63a8\u8350\u7684\u51e0\u4e2a\u7b80\u5355\u53c8\u5b9e\u7528\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u5f00\u53d1\u5c0f\u6280\u5de7\u63d2\u56fe2\" \/><\/p>\n<p>\u5176\u4e2d\u6211\u4eec\u9700\u8981\u5173\u6ce8\u7684\u5c31\u662f .js\u3001.json\u3001.scss\u3001.wxml \u6587\u4ef6\uff0c\u53e6\u5916\u7684\u6587\u4ef6 .wxss \u4f1a\u5728\u4f60\u6539\u52a8 .scss \u6587\u4ef6\u4e4b\u540e\u81ea\u52a8\u751f\u6210\u5e76\u66f4\u65b0\uff0c\u800c .wxss.map \u662f\u63d2\u4ef6\u81ea\u52a8\u751f\u6210\u7684\u6620\u5c04\u5173\u7cfb\uff0c\u4e0d\u7528\u7ba1\u3002<\/p>\n<p>\u5982\u679c\u4e0d\u662f\u4f7f\u7528 webstorm\uff0c\u53ef\u4ee5\u76f4\u63a5\u6267\u884c\u547d\u4ee4 sass &#8211;watch index.scss:index.wxss -s expanded\uff0c\u547d\u4ee4\u884c\u5982\u679c\u5173\u95ed\uff0csass \u547d\u4ee4\u5c31\u4e0d\u4f1a\u76d1\u542c\u6587\u4ef6\u7684\u53d8\u52a8\u7136\u540e\u7f16\u8bd1\uff0c\u6240\u4ee5\u6700\u597d\u7528\u7f16\u8f91\u5668\u7684\u63d2\u4ef6\u3002<\/p>\n<p>\u540c\u7406\uff0c\u4e5f\u53ef\u4ee5\u4f7f\u7528 less\u3001stylus \u7b49\u9884\u7f16\u8bd1\u8bed\u8a00\u3002<\/p>\n<h3>4.2 Visual Studio Code \u914d\u7f6e\u65b9\u6cd5<\/h3>\n<p>\u4e07\u80fd\u7684 VSC \u5f53\u7136\u4e5f\u53ef\u4ee5\u505a\u5230\u8fd9\u4e2a\u529f\u80fd\uff0c\u641c\u7d22\u5e76\u4e0b\u8f7d\u63d2\u4ef6 easy sass\uff0c\u7136\u540e\u5728 setting.json \u4e2d\u4fee\u6539\/\u589e\u52a0\u914d\u7f6e\uff1a<\/p>\n<pre>\"easysass.formats\":&nbsp;[\n&nbsp;&nbsp;{&nbsp;&nbsp;&nbsp;&nbsp;\"format\":&nbsp;\"expanded\",&nbsp;&nbsp;&nbsp;&nbsp;\"extension\":&nbsp;\".wxss\"\n&nbsp;&nbsp;},\n&nbsp;&nbsp;{&nbsp;&nbsp;&nbsp;&nbsp;\"format\":&nbsp;\"compressed\",&nbsp;&nbsp;&nbsp;&nbsp;\"extension\":&nbsp;\".min.wxss\"\n&nbsp;&nbsp;}\n]\u590d\u5236\u4ee3\u7801<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u4e0a\u9762 expanded \u662f\u7f16\u8bd1\u751f\u6210\u7684 .wxss \u6587\u4ef6\uff0c\u4e0b\u9762 compressed \u662f\u538b\u7f29\u4e4b\u540e\u7684 .wxss \u6837\u5f0f\u6587\u4ef6\uff0c\u4e0b\u9762\u8fd9\u4e2a\u7528\u4e0d\u5230\u53ef\u4ee5\u628a\u4e0b\u9762\u8fd9\u4e2a\u914d\u7f6e\u53bb\u6389\uff0c\u7136\u540e\u5728 .gitignore \u6587\u4ef6\u4e2d\u52a0\u5165\u8981\u5ffd\u7565\u7684\u4e2d\u95f4\u6837\u5f0f\uff1a<\/p>\n<pre>*.scss\u590d\u5236\u4ee3\u7801<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u5f53\u7136\u4e5f\u53ef\u4ee5\u4e0d\u6dfb\u52a0\uff0c\u5982\u679c\u4f60\u7684\u540c\u4e8b\u4e5f\u662f\u5b9e\u7528 scss \u6765\u5f00\u53d1\u5c0f\u7a0b\u5e8f\u7684\u8bdd\uff0c\u5176\u4ed6\u8ddf\u4e0a\u9762\u4e00\u6837\uff0c\u81f3\u6b64\u4f60\u5c31\u53ef\u4ee5\u5728\u5c0f\u7a0b\u5e8f\u5f00\u53d1\u4e2d\u5feb\u4e50\u4f7f\u7528 scss \u4e86\uff5e<\/p>\n<h2>5. \u4f7f\u7528 iconfont \u56fe\u6807\u5b57\u4f53<\/h2>\n<p>\u5728 Web \u5f00\u53d1\u4e2d iconfont \u53ef\u8c13\u662f\u6700\u5e38\u7528\u7684\u7075\u6d3b\u56fe\u6807\u5b57\u4f53\u5de5\u5177\u4e86\uff0c\u8fd9\u91cc\u4ecb\u7ecd\u4e00\u4e0b\u5982\u4f55\u5728\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u4e2d\u5f15\u5165 iconfont \u56fe\u6807\u3002<\/p>\n<p>\u9996\u5148\u627e\u5230\u4f60\u60f3\u4f7f\u7528\u7684\u56fe\u6807\u4eec\uff0c\u70b9\u51fb\u8d2d\u7269\u8f66\u4e4b\u540e\u4e0b\u8f7d\u5230\u672c\u5730\u3002<\/p>\n<p><img decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/052\/315ef60473da8fca8cd9e7ec6866fd80-2.png\" style=\"max-width:90%\" title=\"\u5f3a\u70c8\u63a8\u8350\u7684\u51e0\u4e2a\u7b80\u5355\u53c8\u5b9e\u7528\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u5f00\u53d1\u5c0f\u6280\u5de7\u63d2\u56fe3\" alt=\"\u5f3a\u70c8\u63a8\u8350\u7684\u51e0\u4e2a\u7b80\u5355\u53c8\u5b9e\u7528\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u5f00\u53d1\u5c0f\u6280\u5de7\u63d2\u56fe3\" \/><\/p>\n<p>\u4e0b\u8f7d\u5230\u672c\u5730\u662f\u4e00\u4e2a\u538b\u7f29\u5305\uff0c\u89e3\u538b\u7f29\u4e4b\u540e\u5c06 iconfont.css \u6587\u4ef6\u590d\u5236\u5230\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u7684 styles \u6587\u4ef6\u5939\u4e2d \uff08\u5728\u4e0b\u7684\u4e60\u60ef\uff0c\u4e5f\u53ef\u4ee5\u653e\u5230\u4f60\u60f3\u653e\u7684\u5730\u65b9\u6bd4\u5982 fonts\uff09\uff0c\u5c06\u540e\u7f00\u6539\u4e3a .wxss<\/p>\n<p><img decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/052\/da03ce73dec0cb9d1e9680a1d62136a5-3.png\" style=\"max-width:90%\" title=\"\u5f3a\u70c8\u63a8\u8350\u7684\u51e0\u4e2a\u7b80\u5355\u53c8\u5b9e\u7528\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u5f00\u53d1\u5c0f\u6280\u5de7\u63d2\u56fe4\" alt=\"\u5f3a\u70c8\u63a8\u8350\u7684\u51e0\u4e2a\u7b80\u5355\u53c8\u5b9e\u7528\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u5f00\u53d1\u5c0f\u6280\u5de7\u63d2\u56fe4\" \/><\/p>\n<p>\u5728 app.wxss \u4e2d\u5f15\u5165\u6837\u5f0f\uff1a<\/p>\n<pre>@import&nbsp;\"styles\/iconfont.wxss\";\u590d\u5236\u4ee3\u7801<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u7136\u540e\u5728 .wxml \u4e2d\u5c31\u53ef\u4ee5\u4f7f\u7528\u521a\u521a\u4f60\u6dfb\u52a0\u7684\u56fe\u6807\u4e86\uff0cWeb \u4f7f\u7528 i \u6807\u7b7e\uff0c\u5c0f\u7a0b\u5e8f\u4e2d\u4f7f\u7528 text \u6807\u7b7e\uff1a<\/p>\n<pre>&lt;text&gt;&lt;\/text&gt;\u590d\u5236\u4ee3\u7801<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u5982\u679c\u540e\u9762\u8981\u52a0\u65b0\u7684\u56fe\u6807\uff0c\u8981\u4e0b\u8f7d\u65b0\u7684 iconfont.css \u7684\u6587\u4ef6\u5230\u672c\u5730\u91cd\u547d\u540d\u5e76\u8986\u76d6\uff0c\u91cd\u65b0\u8d70\u4e00\u904d\u8fd9\u4e2a\u6d41\u7a0b\u3002<\/p>\n<blockquote><p>\n  \u76f8\u5173\u514d\u8d39\u5b66\u4e60\u63a8\u8350\uff1a\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u5f00\u53d1\n<\/p><\/blockquote>\n<p>\u4ee5\u4e0a\u5c31\u662f\u5f3a\u70c8\u63a8\u8350\u7684\u51e0\u4e2a\u7b80\u5355\u53c8\u5b9e\u7528\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u5f00\u53d1\u5c0f\u6280\u5de7\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>\u680f\u76ee\u4eca\u5929\u5f3a\u70c8\u63a8\u4ecb\u7684\u51e0\u7b80\u5355\u53c8\u5b9e\u7528\u4e2a\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u5f00\u53d1\u5c0f\u6280\u5de7\u3002 \u524d\u6bb5\u65f6\u95f4\u5728\u4e0b\u5f00\u53d1\u4e86\u4e2a\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\uff0c\u5f00\u53d1\u8fc7\u7a0b\u4e2d\u603b\u7ed3\u4e86\u4e00\u4e9b\u6211\u89c9\u5f97\u5bf9\u6211\u6709\u7528\u7684\u5c0f\u6280\u5de7\uff0c\u63d0\u70bc\u51fa\u6765\uff0c\u76f8\u5f53\u4e8e\u4e00\u4e2a\u603b\u7ed3\u590d\u76d8\uff0c\u4e5f\u5e0c\u671b\u53ef\u4ee5\u5e2e\u52a9\u5230\u5927\u5bb6\u3002\u5982\u679c\u5bf9\u5927\u5bb6\u786e\u5b9e\u6709\u5e2e\u52a9\uff0c\u522b\u5fd8\u4e86\u70b9\u8d5e\u54e6&nbsp; \u5fae\u4fe1\u5f00\u53d1\u8005\u5de5\u5177\u7248\u672c\uff1a1.03.2006090\uff082020-06-19\uff09 \u57fa\u7840\u5e93\u7248\u672c\uff1a v2.12.1 (2020-08-04) 1. \u5f00\u53d1\u4e2d\u53ef\u80fd\u9047\u5230\u7684\u5751\u4ee5\u53ca Tips \u672c\u6765\u60f3\u5199\u4e2a\u5c0f\u6280\u5de7\u7684\uff0c\u7ed3\u679c\u6211\u603b\u7ed3\u4e86\u4e00\u5806\u5751\uff0c\u6ca1\u4e0a\u624b\u4e4b\u524d\u5b8c\u5168\u60f3\u8c61\u4e0d\u5230\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u7684\u5f00\u53d1\u4f53\u9a8c\u662f\u5982\u6b64\u4e4b\u5dee\u3001\u5982\u6b64\u4e4b\u70c2\uff0c\u4ece\u5fae\u4fe1\u5f00\u53d1\u8005\u5de5\u5177\u5230\u6240\u8c13\u7684\u300c\u5168\u65b0\u8bed\u8a00\u300d\uff0c\u90fd\u6709\u4e00\u79cd\u6d53\u6d53\u7684\u534a\u6210\u54c1\u7684 five \u5373\u89c6\u611f\uff0c\u5b9e\u5728\u8ba9\u6211 emmm&#8230;. \u53e6\u5916\u6211\u53d1\u73b0\u7f51\u4e0a\u7684\u5c0f\u7a0b\u5e8f\u6587\u7ae0\u5927\u90e8\u5206\u90fd\u662f\u5982\u4f55\u4f7f\u7528\u548c\u5982\u4f55\u907f\u5751\u7684\u5b9e\u7528\u6587\uff0c\u800c\u4e0d\u662f\u6280\u5de7\u6587\uff0c\u8fd9\u4e5f\u4ece\u4fa7\u9762\u53cd\u6620\u4e86\u5c0f\u7a0b\u5e8f\u7684\u5751\u591a\u3002 \u5728\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u539f\u751f\u5f00\u53d1\u8fc7\u7a0b\u4e2d\uff0c\u6211\u4e0d\u65ad\u53d1\u51fa\u8fd9\u6837\u7684\u7591\u95ee\u300c\u4e3a\u4ec0\u4e48\u5802\u5802\u6280\u672f\u4eba\u624d\u591a\u5982\u725b\u6bdb\u7684\u817e\u8baf\uff0c\u4f1a\u63a8\u51fa\u5982\u6b64 laji\u300d\uff0c\u5f88\u591a\u5f31\u667a\u53cd\u4eba\u7c7b\u7684\u5730\u65b9\uff0c\u5728\u4e24\u4e09\u5e74\u524d\u793e\u533a\u5c31\u5df2\u7ecf\u63d0\u51fa\u6765\uff0c\u5b98\u65b9\u56de\u590d\u5df2\u7ecf\u53cd\u9988\u6b63\u5728\u4fee\u590d\u4e2d\uff0c\u4f46\u51e0\u5e74\u8fc7\u53bb\u4e86\uff0c\u8fd8\u662f\u6ca1\u6709\u97f3\u4fe1\uff0c\u5b98\u65b9\u56de\u590d\u4ecd\u7136\u662f\u4e00\u53e5\u51b7\u51b0\u51b0\u7684\u300c\u5df2\u53cd\u9988\u300d \u5fae\u4fe1\u5f00\u53d1\u8005\u5de5\u5177\u7ecf\u5e38\u70ed\u66f4\u65b0\u4e0d\u8d77\u4f5c\u7528\u751a\u81f3\u767d\u5c4f\uff0c\u91cd\u65b0\u7f16\u8bd1\u4e5f\u4e0d\u884c\uff0c\u53ea\u80fd\u5f3a\u884c\u9000\u51fa\u540e\u518d\u6b21\u6253\u5f00\uff1b \u8ddf\u4e0a\u4e00\u6761\u7c7b\u4f3c\uff0c\u6709\u65f6\u5019\u4e00\u70b9\u6837\u5f0f\u51fa\u9519\uff0c\u9884\u89c8\u6574\u4e2a\u90fd\u767d\u5c4f\uff0c\u8c03\u8bd5\u5668\u91cc\u4e5f\u4e0d\u8bf4\u54ea\u91cc\u7684\u95ee\u9898\uff0c\u76f4\u63a5\u5c31\u7ed9\u4f60\u5f03\u7597\u4e0d\u663e\u793a\uff0c\u91cd\u65b0\u7f16\u8bd1\u4e5f\u65e0\u6cd5\u89e3\u51b3\u95ee\u9898\uff0c\u53ea\u80fd\u5f3a\u884c\u9000\u51fa\u540e\u518d\u6b21\u6253\u5f00\uff1b \u8ddf\u4e0a\u4e00\u6761\u7c7b\u4f3c\uff0c\u8c03\u8bd5\u5668\u91cc\u62a5\u7684\u9519\u7ecf\u5e38\u6ca1\u4ec0\u4e48\u7528\uff0c\u9a74\u5934\u4e0d\u5bf9\u9a6c\u5634\uff0c\u8ba9\u4eba\u5f88\u96be\u5b9a\u4f4d\u95ee\u9898\uff1b Android \u7aef\u81ea\u5b9a\u4e49 Tabbar \u5728\u4e0b\u62c9\u5237\u65b0\u7684\u65f6\u5019\uff0c\u4e5f\u4f1a\u8ddf\u7740\u5c4f\u5e55\u4e00\u8d77\u5f80\u4e0b\u79fb\uff0c\u800c\u4e14\u662f\u65e0\u6cd5\u7ed5\u8fc7\u7684 Bug\uff0c\u81ea\u5b9a\u4e49 Tabbar \u6837\u5f0f\u90fd\u5199\u597d\u4e86\u7684\u6211\u53c8\u6539\u6210\u81ea\u5e26\u7684 Tabbar \u4e86\uff01 import \u7684\u8def\u5f84\u4e0d\u652f\u6301\u7edd\u5bf9\u8def\u5f84\uff0c\u6bd4\u5982\u4f60\u5e0c\u671b\u5f15\u7528 utils\/fetch.js\uff0c\u5728\u4e0d\u7ba1\u591a\u6df1\u7684\u7ec4\u4ef6\u91cc\u9762\u4f60\u90fd\u8981\u6162\u6162 ..\/ \u70b9\u5230\u6839\u76ee\u5f55\uff0c\u540c\u6837 .wxss \u6587\u4ef6 @import \u5bfc\u5165\u6587\u4ef6\u65f6\u4e5f\u53ea\u80fd\u4f7f\u7528\u76f8\u5bf9\u8def\u5f84\uff0c\u6240\u4ee5\u5c31\u4f1a\u51fa\u73b0 ..\/..\/..\/..\/..\/..\/utils\/fetch.js \u8fd9\u79cd\u4e1c\u897f\uff1b \u9759\u6001\u8d44\u6e90\u8def\u5f84\u4e0d\u80fd\u6709\u6c49\u5b57\uff0c\u6709\u6c49\u5b57\u5c31\u65e0\u6cd5\u52a0\u8f7d\uff1b .wxs \u6587\u4ef6\u4e0d\u652f\u6301 ES6\uff0c\u53ea\u80fd\u4f7f\u7528\u8e69\u811a\u7684 ES5 \u5199\u6cd5\uff1b .wxml \u4e2d\u53ea\u80fd\u5f15\u5165 .wxs \u6587\u4ef6\u4e0d\u80fd\u5f15\u5165 .js \u6587\u4ef6\uff1f\uff1f\uff1f \u6a21\u677f {{}} \u4e2d\u8fde\u65b9\u6cd5\u90fd\u4e0d\u80fd\u6267\u884c\uff0c\u53ea\u80fd\u5904\u7406\u7b80\u5355\u7684\u8fd0\u7b97\u5982 + [&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-33658","post","type-post","status-publish","format-standard","hentry","category-19"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/33658","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=33658"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/33658\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=33658"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=33658"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=33658"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}