{"id":30361,"date":"2024-11-25T13:01:33","date_gmt":"2024-11-25T05:01:33","guid":{"rendered":"https:\/\/fwq.ai\/blog\/30361\/"},"modified":"2024-11-25T13:01:33","modified_gmt":"2024-11-25T05:01:33","slug":"%e8%af%a6%e8%a7%a3%e5%be%ae%e4%bf%a1%e5%bc%80%e5%8f%91%e4%b8%ad%e8%a7%86%e5%9b%be%e5%b1%82%ef%bc%88xx-xml%e5%92%8c%e9%80%bb%e8%be%91%e5%b1%82xx-js","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/30361\/","title":{"rendered":"\u8be6\u89e3\u5fae\u4fe1\u5f00\u53d1\u4e2d\u89c6\u56fe\u5c42\uff08xx.xml)\u548c\u903b\u8f91\u5c42(xx.js)"},"content":{"rendered":"<p>\u8fd9\u7bc7\u6587\u7ae0\u4e3b\u8981\u4ecb\u7ecd\u4e86\u5fae\u4fe1\u5c0f\u7a0b\u5e8f \u89c6\u56fe\u5c42\uff08xx.xml)\u548c\u903b\u8f91\u5c42(xx.js)\u8be6\u7ec6\u4ecb\u7ecd\u7684\u76f8\u5173\u8d44\u6599,\u9700\u8981\u7684\u670b\u53cb\u53ef\u4ee5\u53c2\u8003\u4e0b<\/p>\n<p>\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u53ef\u4ee5\u7406\u89e3\u4e3a\u4e91OS\u7684\u6982\u5ff5\uff0c\u5fae\u4fe1\u751f\u6001\u672c\u8eab\u5c31\u662f\u4e00\u4e2aOS\u3002\u52a0\u4e0a\u5fae\u4fe1\u516c\u4f17\u5e73\u53f0\u548c\u5fae\u4fe1\u5f00\u53d1\u5e73\u53f0\u672c\u8eab\u5df2\u7ecf\u662f\u975e\u5e38\u6210\u719f\u7684\u67b6\u6784\uff0c\u80fd\u591f\u5b8c\u7f8e\u5ab2\u7f8eApp\u7684\u529f\u80fd\uff0c\u540c\u65f6\u5728\u4ea4\u4e92\u4f53\u9a8c\u65b9\u9762\u4e5f\u80fd\u591f\u505a\u5230\u6781\u81f4\uff0c\u5927\u6709\u53d6\u4ee3App\u4e4b\u52bf\u3002\u82f9\u679cApp Store\u6a21\u5f0f\u7684\u610f\u4e49\u5728\u4e8e\u4e3a\u7b2c\u4e09\u65b9\u8f6f\u4ef6\u7684\u63d0\u4f9b\u8005\u63d0\u4f9b\u4e86\u65b9\u4fbf\u800c\u53c8\u9ad8\u6548\u7684\u4e00\u4e2a\u8f6f\u4ef6\u9500\u552e\u5e73\u53f0\u3002\u7528\u6237\u8d2d\u4e70\u5e94\u7528\u6240\u652f\u4ed8\u7684\u8d39\u7528\u7531\u82f9\u679c\u4e0e\u5e94\u7528\u5f00\u53d1\u55463\uff1a7\u5206\u6210\u3002\u5982\u679c\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u5546\u57ce\u4e5f\u91c7\u7528\u7c7b\u4f3c\u7684\u5206\u4f63\u6a21\u5f0f\uff0c\u90a38\u4ebf\u591a\u7684\u7528\u6237\u5c06\u662f\u4e00\u4e2a\u975e\u5e38\u5927\u7684\u65e0\u5f62\u8d44\u4ea7\uff0c\u6210\u4e3a\u817e\u8baf\u7ee7\u6e38\u620f\u3001\u4f1a\u5458\u3001\u5e7f\u544a\u540e\u7684\u53e6\u4e00\u4e2a\u6398\u91d1\u6e90\u3002<\/p>\n<p>\u3000\u3000\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u5141\u8bb8\u4eba\u4eec\u65e0\u9700\u8fdb\u884c\u4e0b\u8f7d\u5b89\u88c5\u5c31\u4f7f\u7528App\u3002\u7528\u6237\u53ef\u4ee5\u5728\u5fae\u4fe1\u4e0a\u626b\u63cf\u4e8c\u7ef4\u7801\u6765\u6253\u5f00\u7a0b\u5e8f\u3002\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u53ef\u4ee5\u5e94\u7528\u5728\u5b89\u5353\u548ciOS\u7b49\u4e0d\u540c\u7cfb\u7edf\u4e0a\uff0c\u4e5f\u53ef\u4ee5\u5728\u4e0d\u540c\u7684\u5e73\u53f0\u4e0a\u5206\u4eab\uff0c\u56e0\u4e3a\u5b83\u672c\u8eab\u5c31\u7c7b\u4f3c\u4e00\u4e2a\u7f51\u7ad9\u9875\u9762\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/001\/506\/161d5c34d05b716c93893639052630c8-0.jpg\" class=\"aligncenter\" title=\"\u8be6\u89e3\u5fae\u4fe1\u5f00\u53d1\u4e2d\u89c6\u56fe\u5c42\uff08xx.xml)\u548c\u903b\u8f91\u5c42(xx.js)\u63d2\u56fe\" alt=\"\u8be6\u89e3\u5fae\u4fe1\u5f00\u53d1\u4e2d\u89c6\u56fe\u5c42\uff08xx.xml)\u548c\u903b\u8f91\u5c42(xx.js)\u63d2\u56fe\" \/><\/p>\n<p><strong>\u5c0f\u7a0b\u5e8f\u89c6\u56fe\u5c42\uff08xx.xml)\u548c\u903b\u8f91\u5c42(xx.js)<\/strong><\/p>\n<p>\u6574\u4e2a\u7cfb\u7edf\u5206\u4e3a\u4e24\u5757\u89c6\u56fe\u5c42\uff08View\uff09\u548c\u903b\u8f91\u5c42\uff08App Service\uff09<\/p>\n<p>\u6846\u67b6\u53ef\u4ee5\u8ba9\u6570\u636e\u4e0e\u89c6\u56fe\u975e\u5e38\u7b80\u5355\u5730\u4fdd\u6301\u540c\u6b65\u3002\u5f53\u505a\u6570\u636e\u4fee\u6539\u7684\u65f6\u5019\uff0c\u53ea\u9700\u8981\u5728\u903b\u8f91\u5c42\u4fee\u6539\u6570\u636e\uff0c\u89c6\u56fe\u5c42\u5c31\u4f1a\u505a\u76f8\u5e94\u7684\u66f4\u65b0\u3002<\/p>\n<p>\u901a\u8fc7\u8fd9\u4e2a\u7b80\u5355\u7684\u4f8b\u5b50\u6765\u770b\uff1a<\/p>\n<pre>&lt;!-- This is our View --&gt;\r\n&lt;view&gt;&nbsp;Hello&nbsp;{{name}}!&nbsp;&lt;\/view&gt;&lt;button&gt;&nbsp;Click&nbsp;me!&nbsp;&lt;\/button&gt;\r\n\/\/&nbsp;This&nbsp;is&nbsp;our&nbsp;App&nbsp;Service.\r\n\/\/&nbsp;This&nbsp;is&nbsp;our&nbsp;data.\r\nvar&nbsp;helloData&nbsp;=&nbsp;{\r\n&nbsp;name:&nbsp;'WeChat'\r\n}\r\n\r\n\/\/&nbsp;Register&nbsp;a&nbsp;Page.\r\nPage({\r\n&nbsp;data:&nbsp;helloData,\r\n&nbsp;changeName:&nbsp;function(e)&nbsp;{\r\n&nbsp;&nbsp;\/\/&nbsp;sent&nbsp;data&nbsp;change&nbsp;to&nbsp;view\r\n&nbsp;&nbsp;this.setData({\r\n&nbsp;&nbsp;&nbsp;name:&nbsp;'MINA'\r\n&nbsp;&nbsp;})\r\n&nbsp;}\r\n})<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<ol>\n<li>\n<p>\u5f00\u53d1\u8005\u901a\u8fc7\u6846\u67b6\u5c06\u903b\u8f91\u5c42\u6570\u636e\u4e2d\u7684 name \u4e0e\u89c6\u56fe\u5c42\u7684 name \u8fdb\u884c\u4e86\u7ed1\u5b9a\uff0c\u6240\u4ee5\u5728\u9875\u9762\u4e00\u6253\u5f00\u7684\u65f6\u5019\u4f1a\u663e\u793a Hello WeChat!<\/p>\n<\/li>\n<li>\n<p>\u5f53\u70b9\u51fb\u6309\u94ae\u7684\u65f6\u5019\uff0c\u89c6\u56fe\u5c42\u4f1a\u53d1\u9001 changeName \u7684\u4e8b\u4ef6\u7ed9\u903b\u8f91\u5c42\uff0c\u903b\u8f91\u5c42\u627e\u5230\u5bf9\u5e94\u7684\u4e8b\u4ef6\u5904\u7406\u51fd\u6570<\/p>\n<\/li>\n<li>\n<p>\u903b\u8f91\u5c42\u6267\u884c\u4e86 setData \u7684\u64cd\u4f5c\uff0c\u5c06 name \u4ece WeChat \u53d8\u4e3a MINA\uff0c\u56e0\u4e3a\u8be5\u6570\u636e\u548c\u89c6\u56fe\u5c42\u5df2\u7ecf\u7ed1\u5b9a\u4e86\uff0c\u4ece\u800c\u89c6\u56fe\u5c42\u4f1a\u81ea\u52a8\u6539\u53d8\u4e3a Hello MINA! \u3002<\/p>\n<\/li>\n<\/ol>\n<p><span style=\"color: #0000ff\">\u89c6\u56fe\u5c42\u4e3a xx.xml<\/span><\/p>\n<p><span style=\"color: #0000ff\">\u903b\u8f91\u5c42\u4e3a xx.js<\/span><\/p>\n<p>\u8bfb\u53d6\u65f6\u4f1a\u5148\u770b\u903b\u8f91\u5c42\u521d\u59cb\u6570\u636e\u6765\u586b\u5145\u89c6\u56fe\u5c42\uff0c\u89c6\u56fe\u5c42\u89e6\u53d1\u903b\u8f91\u5c42\u4e2d\u7684\u4e8b\u4ef6\uff0c\u903b\u8f91\u5c42\u8fd4\u56de\u5e76\u6539\u53d8\u89c6\u56fe\u5c42\u7684\u5185\u5bb9\u3002<\/p>\n<p><strong>&nbsp;\u903b\u8f91\u5c42(App Service)<\/strong><\/p>\n<p>\u5c0f\u7a0b\u5e8f\u5f00\u53d1\u6846\u67b6\u7684\u903b\u8f91\u5c42\u662f\u7531\u7f16\u5199\u3002<\/p>\n<p>\u903b\u8f91\u5c42\u5c06\u6570\u636e\u8fdb\u884c\u5904\u7406\u540e\u53d1\u9001\u7ed9\u89c6\u56fe\u5c42\uff0c\u540c\u65f6\u63a5\u53d7\u89c6\u56fe\u5c42\u7684\u4e8b\u4ef6\u53cd\u9988\u3002 \u5728 JavaScript \u7684\u57fa\u7840\u4e0a\uff0c\u6211\u4eec\u505a\u4e86\u4e00\u4e9b\u4fee\u6539\uff0c\u4ee5\u65b9\u4fbf\u5730\u5f00\u53d1\u5c0f\u7a0b\u5e8f\u3002<\/p>\n<ol>\n<li>\n<p>\u589e\u52a0 App \u548c Page \u65b9\u6cd5\uff0c\u8fdb\u884c\u7a0b\u5e8f\u548c\u9875\u9762\u7684\u6ce8\u518c\u3002<\/p>\n<\/li>\n<li>\n<p>\u63d0\u4f9b\u4e30\u5bcc\u7684 \uff0c\u5982\u626b\u4e00\u626b\uff0c\u652f\u4ed8\u7b49\u5fae\u4fe1\u7279\u6709\u80fd\u529b\u3002<\/p>\n<\/li>\n<li>\n<p>\u6bcf\u4e2a\u9875\u9762\u6709\u72ec\u7acb\u7684\u4f5c\u7528\u57df\uff0c\u5e76\u63d0\u4f9b\u6a21\u5757\u5316\u80fd\u529b\u3002<\/p>\n<\/li>\n<li>\n<p>\u7531\u4e8e\u6846\u67b6\u5e76\u975e\u8fd0\u884c\u5728\u6d4f\u89c8\u5668\u4e2d\uff0c\u6240\u4ee5 JavaScript \u5728 web \u4e2d\u4e00\u4e9b\u80fd\u529b\u90fd\u65e0\u6cd5\u4f7f\u7528\uff0c\u5982 \uff0cwindow \u7b49\u3002<\/p>\n<\/li>\n<li>\n<p>\u5f00\u53d1\u8005\u5199\u7684\u6240\u6709\u4ee3\u7801\u6700\u7ec8\u5c06\u4f1a\u6253\u5305\u6210\u4e00\u4efd JavaScript\uff0c\u5e76\u5728\u5c0f\u7a0b\u5e8f\u542f\u52a8\u7684\u65f6\u5019\u8fd0\u884c\uff0c\u76f4\u5230\u5c0f\u7a0b\u5e8f\u9500\u6bc1\u3002\u7c7b\u4f3c ServiceWorker\uff0c\u6240\u4ee5\u903b\u8f91\u5c42\u4e5f\u79f0\u4e4b\u4e3a App Service\u3002<\/p>\n<\/li>\n<\/ol>\n<p><strong>\u521d\u59cb\u5316\u6570\u636e<\/strong><\/p>\n<p>\u521d\u59cb\u5316\u6570\u636e\u5c06\u4f5c\u4e3a\u9875\u9762\u7684\u7b2c\u4e00\u6b21\u6e32\u67d3\u3002data \u5c06\u4f1a\u4ee5 JSON \u7684\u5f62\u5f0f\u7531\u903b\u8f91\u5c42\u4f20\u81f3\u6e32\u67d3\u5c42\uff0c\u6240\u4ee5\u5176\u6570\u636e\u5fc5\u987b\u662f\u53ef\u4ee5\u8f6c\u6210 JSON \u7684\u683c\u5f0f\uff1a\u5b57\u7b26\u4e32\uff0c\u6570\u5b57\uff0c\u5e03\u5c14\u503c\uff0c\u5bf9\u8c61\uff0c\u6570\u7ec4\u3002<\/p>\n<p>\u6e32\u67d3\u5c42\u53ef\u4ee5\u901a\u8fc7 WXML \u5bf9\u6570\u636e\u8fdb\u884c\u7ed1\u5b9a\u3002<\/p>\n<p>\u793a\u4f8b\u4ee3\u7801\uff1a<\/p>\n<pre>&lt;view&gt;{{text}}&lt;\/view&gt;&lt;view&gt;{{array[0].msg}}&lt;\/view&gt;\r\nPage({\r\n&nbsp;data:&nbsp;{\r\n&nbsp;&nbsp;text:&nbsp;'init&nbsp;data',\r\n&nbsp;&nbsp;array:&nbsp;[{msg:&nbsp;'1'},&nbsp;{msg:&nbsp;'2'}]\r\n&nbsp;}\r\n})<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><span style=\"color: #0000ff\"><strong>Page.prototype.setData()<\/strong><\/span><\/p>\n<p>setData \u51fd\u6570\u7528\u4e8e\u5c06\u6570\u636e\u4ece\u903b\u8f91\u5c42\u53d1\u9001\u5230\u89c6\u56fe\u5c42\uff0c\u540c\u65f6\u6539\u53d8\u5bf9\u5e94\u7684 this.data \u7684\u503c\u3002<\/p>\n<p><span style=\"color: #ff0000\">\u6ce8\u610f\uff1a<\/span><\/p>\n<p>1.\u76f4\u63a5\u4fee\u6539 this.data \u65e0\u6548\uff0c\u65e0\u6cd5\u6539\u53d8\u9875\u9762\u7684\uff0c\u8fd8\u4f1a\u9020\u6210\u6570\u636e\u4e0d\u4e00\u81f4\u3002<br \/>2.\u5355\u6b21\u8bbe\u7f6e\u7684\u6570\u636e\u4e0d\u80fd\u8d85\u8fc71024kB\uff0c\u8bf7\u5c3d\u91cf\u907f\u514d\u4e00\u6b21\u8bbe\u7f6e\u8fc7\u591a\u7684\u6570\u636e<\/p>\n<p><strong>setData() \u53c2\u6570\u683c\u5f0f<\/strong><\/p>\n<p>\u63a5\u53d7\u4e00\u4e2a\u5bf9\u8c61\uff0c\u4ee5 \uff0cvalue \u7684\u5f62\u5f0f\u8868\u793a\u5c06 this.data \u4e2d\u7684 key \u5bf9\u5e94\u7684\u503c\u6539\u53d8\u6210 value\u3002<\/p>\n<p>\u5176\u4e2d key \u53ef\u4ee5\u975e\u5e38\u7075\u6d3b\uff0c\u4ee5\u6570\u636e\u8def\u5f84\u7684\u5f62\u5f0f\u7ed9\u51fa\uff0c\u5982 array[2].message\uff0ca.b.c.d\uff0c\u5e76\u4e14\u4e0d\u9700\u8981\u5728 this.data \u4e2d\u9884\u5148\u5b9a\u4e49\u3002<\/p>\n<p>\u793a\u4f8b\u4ee3\u7801\uff1a<\/p>\n<pre>&lt;!--index.wxml--&gt;\r\n&lt;view&gt;{{text}}&lt;\/view&gt;&lt;button&gt;&nbsp;Change&nbsp;normal&nbsp;data&nbsp;&lt;\/button&gt;\r\n&lt;view&gt;{{array[0].text}}&lt;\/view&gt;&lt;button&gt;&nbsp;Change&nbsp;Array&nbsp;data&nbsp;&lt;\/button&gt;\r\n&lt;view&gt;{{obj.text}}&lt;\/view&gt;&lt;button&gt;&nbsp;Change&nbsp;Object&nbsp;data&nbsp;&lt;\/button&gt;\r\n&lt;view&gt;{{newField.text}}&lt;\/view&gt;&lt;button&gt;&nbsp;Add&nbsp;new&nbsp;data&nbsp;&lt;\/button&gt;\r\n\/\/index.js\r\nPage({\r\n&nbsp;data:&nbsp;{\r\n&nbsp;&nbsp;text:&nbsp;'init&nbsp;data',\r\n&nbsp;&nbsp;array:&nbsp;[{text:&nbsp;'init&nbsp;data'}],\r\n&nbsp;&nbsp;object:&nbsp;{\r\n&nbsp;&nbsp;&nbsp;text:&nbsp;'init&nbsp;data'\r\n&nbsp;&nbsp;}\r\n&nbsp;},\r\n&nbsp;changeText:&nbsp;function()&nbsp;{\r\n&nbsp;&nbsp;\/\/&nbsp;this.data.text&nbsp;=&nbsp;'changed&nbsp;data'&nbsp;\/\/&nbsp;bad,&nbsp;it&nbsp;can&nbsp;not&nbsp;work\r\n&nbsp;&nbsp;this.setData({\r\n&nbsp;&nbsp;&nbsp;text:&nbsp;'changed&nbsp;data'\r\n&nbsp;&nbsp;})\r\n&nbsp;},\r\n&nbsp;changeItemInArray:&nbsp;function()&nbsp;{\r\n&nbsp;&nbsp;\/\/&nbsp;you&nbsp;can&nbsp;use&nbsp;this&nbsp;way&nbsp;to&nbsp;modify&nbsp;a&nbsp;danamic&nbsp;data&nbsp;path\r\n&nbsp;&nbsp;this.setData({\r\n&nbsp;&nbsp;&nbsp;'array[0].text':'changed&nbsp;data'\r\n&nbsp;&nbsp;})\r\n&nbsp;},\r\n&nbsp;changeItemInObject:&nbsp;function(){\r\n&nbsp;&nbsp;this.setData({\r\n&nbsp;&nbsp;&nbsp;'object.text':&nbsp;'changed&nbsp;data'\r\n&nbsp;&nbsp;});\r\n&nbsp;},\r\n&nbsp;addNewField:&nbsp;function()&nbsp;{\r\n&nbsp;&nbsp;this.setData({\r\n&nbsp;&nbsp;&nbsp;'newField.text':&nbsp;'new&nbsp;data'\r\n&nbsp;&nbsp;})\r\n&nbsp;}\r\n})<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u89c6\u56fe\u5c42<\/strong><\/p>\n<p>\u6846\u67b6\u7684\u89c6\u56fe\u5c42\u7531 WXML \u4e0e  \u7f16\u5199\uff0c\u7531\u7ec4\u4ef6\u6765\u8fdb\u884c\u5c55\u793a\u3002<\/p>\n<p>\u5c06\u903b\u8f91\u5c42\u7684\u6570\u636e\u53cd\u5e94\u6210\u89c6\u56fe\uff0c\u540c\u65f6\u5c06\u89c6\u56fe\u5c42\u7684\u4e8b\u4ef6\u53d1\u9001\u7ed9\u903b\u8f91\u5c42\u3002<\/p>\n<p>WXML(WeiXin Markup uage)\u7528\u4e8e\u63cf\u8ff0\u9875\u9762\u7684\u7ed3\u6784\u3002<\/p>\n<p>WXSS(WeiXin Style Sheet)\u7528\u4e8e\u63cf\u8ff0\u9875\u9762\u7684\u6837\u5f0f\u3002<\/p>\n<p>\u7ec4\u4ef6(Component)\u662f\u89c6\u56fe\u7684\u57fa\u672c\u7ec4\u6210\u5355\u5143\u3002<\/p>\n<p><strong>\u4ec0\u4e48\u662f\u4e8b\u4ef6<\/strong><\/p>\n<ol>\n<li>\n<p>\u4e8b\u4ef6\u662f\u89c6\u56fe\u5c42\u5230\u903b\u8f91\u5c42\u7684\u901a\u8baf\u65b9\u5f0f\u3002<\/p>\n<\/li>\n<li>\n<p>\u4e8b\u4ef6\u53ef\u4ee5\u5c06\u7528\u6237\u7684\u53cd\u9988\u5230\u903b\u8f91\u5c42\u8fdb\u884c\u5904\u7406\u3002<\/p>\n<\/li>\n<li>\n<p>\u4e8b\u4ef6\u53ef\u4ee5\u7ed1\u5b9a\u5728\u7ec4\u4ef6\u4e0a\uff0c\u5f53\u8fbe\u5230\u89e6\u53d1\u4e8b\u4ef6\uff0c\u5c31\u4f1a\u6267\u884c\u903b\u8f91\u5c42\u4e2d\u5bf9\u5e94\u7684\u4e8b\u4ef6\u5904\u7406\u51fd\u6570\u3002<\/p>\n<\/li>\n<li>\n<p>\u4e8b\u4ef6\u5bf9\u8c61\u53ef\u4ee5\u643a\u5e26\u989d\u5916\u4fe1\u606f\uff0c\u5982id, dataset, touches\u3002<\/p>\n<\/li>\n<\/ol>\n<p><strong>\u4e8b\u4ef6\u7684\u4f7f\u7528\u65b9\u5f0f<\/strong><\/p>\n<p>\u5728\u7ec4\u4ef6\u4e2d\u7ed1\u5b9a\u4e00\u4e2a\u4e8b\u4ef6\u5904\u7406\u51fd\u6570\u3002<\/p>\n<p>\u5982bindtap\uff0c\u5f53\u7528\u6237\u70b9\u51fb\u8be5\u7ec4\u4ef6\u7684\u65f6\u5019\u4f1a\u5728\u8be5\u9875\u9762\u5bf9\u5e94\u7684Page\u4e2d\u627e\u5230\u76f8\u5e94\u7684\u4e8b\u4ef6\u5904\u7406\u51fd\u6570\u3002<\/p>\n<p><\/p>\n<pre>&lt;view&gt;&nbsp;Click&nbsp;me!&nbsp;&lt;\/view&gt;\r\n\u5728\u76f8\u5e94\u7684Page\u5b9a\u4e49\u4e2d\u5199\u4e0a\u76f8\u5e94\u7684\u4e8b\u4ef6\u5904\u7406\u51fd\u6570\uff0c\u53c2\u6570\u662fevent\u3002\r\nPage({\r\n&nbsp;tapName:&nbsp;function(event)&nbsp;{\r\n&nbsp;&nbsp;console.log(event)\r\n&nbsp;}\r\n})<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u57fa\u7840\u7ec4\u4ef6<\/strong><\/p>\n<p>\u6846\u67b6\u4e3a\u5f00\u53d1\u8005\u63d0\u4f9b\u4e86\u4e00\u7cfb\u5217\u57fa\u7840\u7ec4\u4ef6\uff0c\u5f00\u53d1\u8005\u53ef\u4ee5\u901a\u8fc7\u7ec4\u5408\u8fd9\u4e9b\u57fa\u7840\u7ec4\u4ef6\u8fdb\u884c\u5feb\u901f\u5f00\u53d1\u3002<\/p>\n<p>\u4ec0\u4e48\u662f\u7ec4\u4ef6\uff1a<\/p>\n<ol>\n<li>\n<p>\u7ec4\u4ef6\u662f\u89c6\u56fe\u5c42\u7684\u57fa\u672c\u7ec4\u6210\u5355\u5143\u3002<\/p>\n<\/li>\n<li>\n<p>\u7ec4\u4ef6\u81ea\u5e26\u4e00\u4e9b\u529f\u80fd\u4e0e\u5fae\u4fe1\u98ce\u683c\u7684\u6837\u5f0f\u3002<\/p>\n<\/li>\n<li>\n<p>\u4e00\u4e2a\u7ec4\u4ef6\u901a\u5e38\u5305\u62ec\u5f00\u59cb\u6807\u7b7e\u548c\u7ed3\u675f\u6807\u7b7e\uff0c\u5c5e\u6027\u7528\u6765\u4fee\u9970\u8fd9\u4e2a\u7ec4\u4ef6\uff0c\u5185\u5bb9\u5728\u4e24\u4e2a\u6807\u7b7e\u4e4b\u5185\u3002<\/p>\n<\/li>\n<\/ol>\n<pre>&lt;tagname&gt;\r\n&nbsp;Content&nbsp;goes&nbsp;here&nbsp;...\r\n&lt;\/tagname&gt;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><span style=\"color: #ff0000\">\u6ce8\u610f\uff1a<\/span>\u6240\u6709\u7ec4\u4ef6\u4e0e\u5c5e\u6027\u90fd\u662f\u5c0f\u5199\uff0c\u4ee5\u8fde\u5b57\u7b26-\u8fde\u63a5<\/p>\n<p>\u3010\u76f8\u5173\u63a8\u8350\u3011<\/p>\n<p>1.&nbsp;<\/p>\n<p>2.&nbsp;<\/p>\n<p>3.&nbsp;<\/p>\n<p>4.&nbsp;<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u8be6\u89e3\u5fae\u4fe1\u5f00\u53d1\u4e2d\u89c6\u56fe\u5c42\uff08xx.xml)\u548c\u903b\u8f91\u5c42(xx.js)\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\u5fae\u4fe1\u5c0f\u7a0b\u5e8f \u89c6\u56fe\u5c42\uff08xx.xml)\u548c\u903b\u8f91\u5c42(xx.js)\u8be6\u7ec6\u4ecb\u7ecd\u7684\u76f8\u5173\u8d44\u6599,\u9700\u8981\u7684\u670b\u53cb\u53ef\u4ee5\u53c2\u8003\u4e0b \u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u53ef\u4ee5\u7406\u89e3\u4e3a\u4e91OS\u7684\u6982\u5ff5\uff0c\u5fae\u4fe1\u751f\u6001\u672c\u8eab\u5c31\u662f\u4e00\u4e2aOS\u3002\u52a0\u4e0a\u5fae\u4fe1\u516c\u4f17\u5e73\u53f0\u548c\u5fae\u4fe1\u5f00\u53d1\u5e73\u53f0\u672c\u8eab\u5df2\u7ecf\u662f\u975e\u5e38\u6210\u719f\u7684\u67b6\u6784\uff0c\u80fd\u591f\u5b8c\u7f8e\u5ab2\u7f8eApp\u7684\u529f\u80fd\uff0c\u540c\u65f6\u5728\u4ea4\u4e92\u4f53\u9a8c\u65b9\u9762\u4e5f\u80fd\u591f\u505a\u5230\u6781\u81f4\uff0c\u5927\u6709\u53d6\u4ee3App\u4e4b\u52bf\u3002\u82f9\u679cApp Store\u6a21\u5f0f\u7684\u610f\u4e49\u5728\u4e8e\u4e3a\u7b2c\u4e09\u65b9\u8f6f\u4ef6\u7684\u63d0\u4f9b\u8005\u63d0\u4f9b\u4e86\u65b9\u4fbf\u800c\u53c8\u9ad8\u6548\u7684\u4e00\u4e2a\u8f6f\u4ef6\u9500\u552e\u5e73\u53f0\u3002\u7528\u6237\u8d2d\u4e70\u5e94\u7528\u6240\u652f\u4ed8\u7684\u8d39\u7528\u7531\u82f9\u679c\u4e0e\u5e94\u7528\u5f00\u53d1\u55463\uff1a7\u5206\u6210\u3002\u5982\u679c\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u5546\u57ce\u4e5f\u91c7\u7528\u7c7b\u4f3c\u7684\u5206\u4f63\u6a21\u5f0f\uff0c\u90a38\u4ebf\u591a\u7684\u7528\u6237\u5c06\u662f\u4e00\u4e2a\u975e\u5e38\u5927\u7684\u65e0\u5f62\u8d44\u4ea7\uff0c\u6210\u4e3a\u817e\u8baf\u7ee7\u6e38\u620f\u3001\u4f1a\u5458\u3001\u5e7f\u544a\u540e\u7684\u53e6\u4e00\u4e2a\u6398\u91d1\u6e90\u3002 \u3000\u3000\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u5141\u8bb8\u4eba\u4eec\u65e0\u9700\u8fdb\u884c\u4e0b\u8f7d\u5b89\u88c5\u5c31\u4f7f\u7528App\u3002\u7528\u6237\u53ef\u4ee5\u5728\u5fae\u4fe1\u4e0a\u626b\u63cf\u4e8c\u7ef4\u7801\u6765\u6253\u5f00\u7a0b\u5e8f\u3002\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u53ef\u4ee5\u5e94\u7528\u5728\u5b89\u5353\u548ciOS\u7b49\u4e0d\u540c\u7cfb\u7edf\u4e0a\uff0c\u4e5f\u53ef\u4ee5\u5728\u4e0d\u540c\u7684\u5e73\u53f0\u4e0a\u5206\u4eab\uff0c\u56e0\u4e3a\u5b83\u672c\u8eab\u5c31\u7c7b\u4f3c\u4e00\u4e2a\u7f51\u7ad9\u9875\u9762\u3002 \u5c0f\u7a0b\u5e8f\u89c6\u56fe\u5c42\uff08xx.xml)\u548c\u903b\u8f91\u5c42(xx.js) \u6574\u4e2a\u7cfb\u7edf\u5206\u4e3a\u4e24\u5757\u89c6\u56fe\u5c42\uff08View\uff09\u548c\u903b\u8f91\u5c42\uff08App Service\uff09 \u6846\u67b6\u53ef\u4ee5\u8ba9\u6570\u636e\u4e0e\u89c6\u56fe\u975e\u5e38\u7b80\u5355\u5730\u4fdd\u6301\u540c\u6b65\u3002\u5f53\u505a\u6570\u636e\u4fee\u6539\u7684\u65f6\u5019\uff0c\u53ea\u9700\u8981\u5728\u903b\u8f91\u5c42\u4fee\u6539\u6570\u636e\uff0c\u89c6\u56fe\u5c42\u5c31\u4f1a\u505a\u76f8\u5e94\u7684\u66f4\u65b0\u3002 \u901a\u8fc7\u8fd9\u4e2a\u7b80\u5355\u7684\u4f8b\u5b50\u6765\u770b\uff1a &lt;!&#8211; This is our View &#8211;&gt; &lt;view&gt;&nbsp;Hello&nbsp;{{name}}!&nbsp;&lt;\/view&gt;&lt;button&gt;&nbsp;Click&nbsp;me!&nbsp;&lt;\/button&gt; \/\/&nbsp;This&nbsp;is&nbsp;our&nbsp;App&nbsp;Service. \/\/&nbsp;This&nbsp;is&nbsp;our&nbsp;data. var&nbsp;helloData&nbsp;=&nbsp;{ &nbsp;name:&nbsp;&#8216;WeChat&#8217; } \/\/&nbsp;Register&nbsp;a&nbsp;Page. Page({ &nbsp;data:&nbsp;helloData, &nbsp;changeName:&nbsp;function(e)&nbsp;{ &nbsp;&nbsp;\/\/&nbsp;sent&nbsp;data&nbsp;change&nbsp;to&nbsp;view &nbsp;&nbsp;this.setData({ &nbsp;&nbsp;&nbsp;name:&nbsp;&#8216;MINA&#8217; &nbsp;&nbsp;}) &nbsp;} }) \u767b\u5f55\u540e\u590d\u5236 \u5f00\u53d1\u8005\u901a\u8fc7\u6846\u67b6\u5c06\u903b\u8f91\u5c42\u6570\u636e\u4e2d\u7684 name \u4e0e\u89c6\u56fe\u5c42\u7684 name \u8fdb\u884c\u4e86\u7ed1\u5b9a\uff0c\u6240\u4ee5\u5728\u9875\u9762\u4e00\u6253\u5f00\u7684\u65f6\u5019\u4f1a\u663e\u793a Hello WeChat! \u5f53\u70b9\u51fb\u6309\u94ae\u7684\u65f6\u5019\uff0c\u89c6\u56fe\u5c42\u4f1a\u53d1\u9001 changeName \u7684\u4e8b\u4ef6\u7ed9\u903b\u8f91\u5c42\uff0c\u903b\u8f91\u5c42\u627e\u5230\u5bf9\u5e94\u7684\u4e8b\u4ef6\u5904\u7406\u51fd\u6570 \u903b\u8f91\u5c42\u6267\u884c\u4e86 setData \u7684\u64cd\u4f5c\uff0c\u5c06 name \u4ece WeChat \u53d8\u4e3a MINA\uff0c\u56e0\u4e3a\u8be5\u6570\u636e\u548c\u89c6\u56fe\u5c42\u5df2\u7ecf\u7ed1\u5b9a\u4e86\uff0c\u4ece\u800c\u89c6\u56fe\u5c42\u4f1a\u81ea\u52a8\u6539\u53d8\u4e3a Hello MINA! \u3002 \u89c6\u56fe\u5c42\u4e3a [&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-30361","post","type-post","status-publish","format-standard","hentry","category-19"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/30361","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=30361"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/30361\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=30361"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=30361"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=30361"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}