{"id":28644,"date":"2024-11-25T12:11:24","date_gmt":"2024-11-25T04:11:24","guid":{"rendered":"https:\/\/fwq.ai\/blog\/28644\/"},"modified":"2024-11-25T12:11:24","modified_gmt":"2024-11-25T04:11:24","slug":"%e5%be%ae%e4%bf%a1%e5%b0%8f%e7%a8%8b%e5%ba%8f%e5%bc%80%e5%8f%91%e6%95%99%e7%a8%8b-app%e5%92%8cpage%e5%87%bd%e6%95%b0%e6%a6%82%e8%bf%b0","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/28644\/","title":{"rendered":"\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u5f00\u53d1\u6559\u7a0b-App()\u548cPage()\u51fd\u6570\u6982\u8ff0"},"content":{"rendered":"<p><strong><span style=\"font-size:24px\">\u4e00\uff0capp()<\/span><\/strong><\/p>\n<p style=\"text-align:left\"><span>\u7528\u6765\u6ce8\u518c\u4e00\u4e2a\u5c0f\u7a0b\u5e8f\u3002\u5728\u5c0f\u7a0b\u5e8f\u542f\u52a8\u7684\u65f6\u5019\u8c03\u7528\uff0c\u5e76\u521b\u5efa\u5c0f\u7a0b\u5e8f\uff0c\u76f4\u5230\u9500\u6bc1\u3002\u5728\u6574\u4e2a\u5c0f\u7a0b\u5e8f\u7684\u751f\u547d\u5468\u671f\u8fc7\u7a0b\u4e2d\uff0c\u5b83\u90fd\u662f\u5b58\u5728\u7684\u3002\u5f88\u663e\u7136\u5b83\u662f\u5355\u4f8b\u7684\uff0c\u5168\u5c40\u7684\u3002\u6240\u4ee5\uff0c<\/span><\/p>\n<p style=\"text-align:left\"><span>1\uff09\u53ea\u80fd\u5728app.js\u4e2d\u6ce8\u518c\u4e00\u6b21\u3002<\/span><\/p>\n<p style=\"text-align:left\"><span>2\uff09\u5728\u4ee3\u7801\u7684\u4efb\u4f55\u5730\u65b9\u90fd\u53ef\u4ee5\u901a\u8fc7 getApp() \u83b7\u53d6\u8fd9\u4e2a\u552f\u4e00\u7684\u5c0f\u7a0b\u5e8f\u5355\u4f8b\uff0c<\/span><\/p>\n<p style=\"text-align:left\"><span>\u6bd4\u5982 var appInstance = getApp();<\/span><\/p>\n<p style=\"text-align:left\"><span>App()\u7684\u53c2\u6570\u662f object \u7c7b\u578b {} \uff0c\u6307\u5b9a\u4e86\u5c0f\u7a0b\u5e8f\u7684\u58f0\u660e\u5468\u671f\u51fd\u6570\u3002<br \/><\/span><\/p>\n<p style=\"text-align:left\"><span><strong>onLaunch \u51fd\u6570<br \/><\/strong><\/span><\/p>\n<p style=\"text-align:left\"><span>\u76d1\u542c\u5c0f\u7a0b\u5e8f\u521d\u59cb\u5316\u3002<\/span><\/p>\n<p style=\"text-align:left\"><span>\u5f53\u5c0f\u7a0b\u5e8f\u521d\u59cb\u5316\u5b8c\u6210\u65f6\uff0c\u4f1a\u89e6\u53d1 onLaunch\uff08\u5168\u5c40\u53ea\u89e6\u53d1\u4e00\u6b21\uff09\u3002<\/span><\/p>\n<p style=\"text-align:left\"><span><strong>onShow \u51fd\u6570<\/strong><\/span><\/p>\n<p style=\"text-align:left\"><span>\u76d1\u542c\u5c0f\u7a0b\u5e8f\u663e\u793a\u3002<\/span><\/p>\n<p style=\"text-align:left\"><span>\u5f53\u5c0f\u7a0b\u5e8f\u542f\u52a8\uff0c\u6216\u4ece\u540e\u53f0\u8fdb\u5165\u524d\u53f0\u663e\u793a\uff0c\u4f1a\u89e6\u53d1\u3002<\/span><\/p>\n<p style=\"text-align:left\"><span><strong>onHide \u51fd\u6570&nbsp;&nbsp;<br \/><\/strong><\/span><\/p>\n<p style=\"text-align:left\"><span>\u76d1\u542c\u5c0f\u7a0b\u5e8f\u9690\u85cf\u3002<\/span><\/p>\n<p style=\"text-align:left\"><span>\u5f53\u5c0f\u7a0b\u5e8f\u4ece\u524d\u53f0\u8fdb\u5165\u540e\u53f0\uff0c\u4f1a\u89e6\u53d1\u3002<br \/><\/span><\/p>\n<p style=\"text-align:left\"><span>\u6240\u8c13\u524d\u540e\u53f0\u7684\u5b9a\u4e49\uff0c\u7c7b\u4f3c\u4e8e\u624b\u673a\u4e0a\u7684app\uff0c\u6bd4\u5982\u5f53\u4e0d\u5728\u4f7f\u7528\u5fae\u4fe1\u65f6\uff0c\u5c31\u8fdb\u5165\u4e86\u540e\u53f0\u3002<\/span><\/p>\n<p style=\"text-align:left\"><span><strong>globalData \u5bf9\u8c61<\/strong><br \/><\/span><\/p>\n<p style=\"text-align:left\"><span>\u5168\u5c40\u6570\u636e\u3002<\/span><\/p>\n<p style=\"text-align:left\"><span><strong>\u4ee3\u7801\u548c\u65e5\u5fd7\u53c2\u8003\uff0c\u5982\u4e0b\u52a8\u56fe\uff1a<\/strong><\/span><\/p>\n<p style=\"line-height:24px;text-indent:nullem;text-align:left\"><span><\/span><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/\/upload\/image\/711\/310\/123\/1488607932941922.gif\" style=\"max-width:90%\" class=\"aligncenter\" title=\"\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u5f00\u53d1\u6559\u7a0b-App()\u548cPage()\u51fd\u6570\u6982\u8ff0\u63d2\u56fe\" alt=\"\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u5f00\u53d1\u6559\u7a0b-App()\u548cPage()\u51fd\u6570\u6982\u8ff0\u63d2\u56fe\" \/><\/p>\n<p style=\"text-align:left\"><span style=\"font-size:24px\">\u4e8c\u3001Page()\u51fd\u6570<\/span><\/p>\n<p style=\"text-align:left\"><span>\u901a\u8fc7App()\u6ce8\u518c\u5b8c\u6210\u5c0f\u7a0b\u5e8f\u4e4b\u540e\uff0c\u6846\u67b6\u5c31\u5f00\u59cb\u6ce8\u518c\u9875\u9762\u3002\u6240\u4ee5\u4e0d\u8981\u5728App()\u7684 onLaunch \u4e2d\u8c03\u7528 getCurrentPage() \u65b9\u6cd5\uff0c\u56e0\u4e3a\u6b64\u65f6\u9875\u9762\u8fd8\u6ca1\u6709\u6ce8\u518c\u5b8c\u6210\u3002<\/span><\/p>\n<p style=\"text-align:left\"><span>\u540c\u6837\u7684Page()\u4e5f\u662f\u6709\u751f\u547d\u5468\u671f\u7684\u3002\u5f53\u9875\u9762\u6ce8\u518c\u5b8c\u6210\u4e4b\u540e\uff0c\u53ef\u4ee5\u5728 page.js \u6587\u4ef6\u4e2d\u8c03\u7528 getCurrentPage() \u65b9\u6cd5\uff0c\u83b7\u53d6\u5f53\u524d\u9875\u9762\u5bf9\u8c61\u3002<\/span><\/p>\n<p style=\"text-align:left\"><span><strong>2.1\uff0cPage()\u7684\u53c2\u6570\u4e5f\u662fObject\u7c7b\u578b\u3002<\/strong><br \/><strong>onLoad&nbsp;&nbsp;<\/strong><br \/>\u76d1\u542c\u9875\u9762\u52a0\u8f7d<\/span><\/p>\n<p style=\"text-align:left\"><span>\u9875\u9762\u521a\u5f00\u59cb\u52a0\u8f7d\u7684\u65f6\u5019\u89e6\u53d1\u3002\u53ea\u4f1a\u8c03\u7528\u4e00\u6b21\u3002<\/span><\/p>\n<p style=\"text-align:left\"><span><strong>onReady <\/strong><br \/>\u76d1\u542c\u9875\u9762\u521d\u6b21\u6e32\u67d3\u5b8c\u6210<br \/><\/span><\/p>\n<p style=\"text-align:left\"><span>\u7c7b\u4f3c\u4e8ehtml\u7684 onReady\u3002\u53ea\u4f1a\u8c03\u7528\u4e00\u6b21\u3002<\/span><\/p>\n<p style=\"text-align:left\"><span><strong>onShow&nbsp;&nbsp;<\/strong><br \/>\u76d1\u542c\u9875\u9762\u663e\u793a<br \/><\/span><\/p>\n<p style=\"text-align:left\"><span>\u9875\u9762\u663e\u793a\u7684\u65f6\u5019\u89e6\u53d1\uff0c\u6bd4\u5982\u9875\u9762\u5207\u6362<\/span><\/p>\n<p style=\"text-align:left\"><span><strong>onHide <\/strong> <br \/>\u76d1\u542c\u9875\u9762\u9690\u85cf<\/span><\/p>\n<p style=\"text-align:left\"><span>\u548conShow\u5bf9\u5e94<\/span><\/p>\n<p style=\"text-align:left\"><span><strong>onUnload&nbsp;&nbsp;<\/strong>&nbsp;&nbsp;<br \/>\u76d1\u542c\u9875\u9762\u5378\u8f7d<br \/><\/span><\/p>\n<p style=\"text-align:left\"><span>\u5728 redirectTo \u6216 navigateBack \u7684\u65f6\u5019\u8c03\u7528<\/span><\/p>\n<p style=\"text-align:left\"><span><strong>onPullDownRefresh<\/strong>&nbsp; &nbsp;<br \/>\u76d1\u542c\u7528\u6237\u4e0b\u62c9\u52a8<br \/><\/span><\/p>\n<p style=\"text-align:left\"><span>1\uff09\u9700\u8981\u5728config\u7684window\u9009\u9879\u4e2d\u5f00\u542fenablePullDownRefresh\u3002<br \/>2\uff09\u5f53\u5904\u7406\u5b8c\u6570\u636e\u5237\u65b0\u540e\uff0cwx.stopPullDownRefresh \u53ef\u4ee5\u505c\u6b62\u5f53\u524d\u9875\u9762\u7684\u4e0b\u62c9\u5237\u65b0\u3002<\/span><\/p>\n<p style=\"text-align:left\"><span><strong>onReachBottom <\/strong>&nbsp;&nbsp;<br \/>\u9875\u9762\u4e0a\u62c9\u89e6\u5e95\u4e8b\u4ef6\u7684\u5904\u7406\u51fd\u6570<\/span><\/p>\n<p style=\"text-align:left\"><span><strong>data<\/strong><\/span><\/p>\n<p style=\"text-align:left\"><span>\u9875\u9762\u7684\u521d\u59cb\u6570\u636e<\/span><\/p>\n<p style=\"text-align:left\"><span><strong>2.2\uff0cPage.prototype.setData()<\/strong><\/span><\/p>\n<p style=\"text-align:left\"><span>Page\u7684\u51fd\u6570 setData() \u7528\u4e8e\u9875\u9762\u521d\u59cb\u6570\u636edata\u7684\u4fee\u6539\u3002\u5982\u679c\u8be5\u6570\u636e\u7ed1\u5b9a\u5230\u4e86\u89c6\u56fe\u5c42wxml\u4e2d\u5c55\u793a\uff0c\u90a3\u4e48\u65e0\u987b\u5237\u65b0\uff0c\u89c6\u56fe\u5c42\u5c31\u4f1a\u53cd\u6620\u51fa\u4fee\u6539\u3002<\/span><\/p>\n<p style=\"text-align:left\"><span>\u5bf9\u4e8edata\u7684\u4fee\u6539\uff0c\u53ea\u80fd\u4f7f\u7528 setData() \uff0c\u4e0d\u80fd\u76f4\u63a5\u901a\u8fc7 this.data \u8fdb\u884c\u4fee\u6539\u3002\u6570\u636e\u91cf\u9650\u5236\u5728 1024 kb\u4ee5\u5185\u3002<\/span><\/p>\n<p style=\"text-align:left\"><span><strong>2.3\uff0cgetCurrentPages()<\/strong><br \/>,\u83b7\u53d6\u5f53\u524d\u9875\u9762\u6808\u7684\u5b9e\u4f8b\uff0c\u4ee5\u6570\u7ec4\u5f62\u5f0f\u6309\u6808\u7684\u987a\u5e8f\u7ed9\u51fa\uff0c\u7b2c\u4e00\u4e2a\u5143\u7d20\u4e3a\u9996\u9875\uff0c\u6700\u540e\u4e00\u4e2a\u5143\u7d20\u4e3a\u5f53\u524d\u9875\u9762\u3002<\/span><\/p>\n<p style=\"text-align:left\"><span><strong>2.4\uff0c\u6848\u4f8b\u52a8\u56fe<\/strong><\/span><\/p>\n<p style=\"line-height:24px;text-indent:nullem;text-align:left\"><span><\/span><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/\/upload\/image\/641\/677\/674\/1488607948425547.gif\" style=\"max-width:90%\" class=\"aligncenter\" title=\"\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u5f00\u53d1\u6559\u7a0b-App()\u548cPage()\u51fd\u6570\u6982\u8ff0\u63d2\u56fe1\" alt=\"\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u5f00\u53d1\u6559\u7a0b-App()\u548cPage()\u51fd\u6570\u6982\u8ff0\u63d2\u56fe1\" \/><\/p>\n<p style=\"text-align:left\"><span style=\"font-size:24px\">\u4e09\u3001\u9875\u9762\u6808<\/span><\/p>\n<p style=\"text-align:left\"><span>\u6846\u67b6\u4ee5\u6808\u7684\u5f62\u5f0f\u7ef4\u62a4\u4e86\u5f53\u524d\u7684\u6240\u6709\u9875\u9762\u3002 \u5f53\u53d1\u751f\u8def\u7531\u5207\u6362\u7684\u65f6\u5019\uff0c\u9875\u9762\u6808\u7684\u8868\u73b0\u5982\u4e0b\uff1a<\/span><\/p>\n<table style=\"width:498px\">\n<tbody>\n<tr>\n<td width=\"180\"><strong>\u8def\u7531\u65b9\u5f0f&nbsp; &nbsp; <\/strong><\/td>\n<td width=\"319\">\n<p style=\"text-align:right\"><strong>\u9875\u9762\u6808\u8868\u73b0<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td width=\"180\">\n<p style=\"text-align:left\">\u521d\u59cb\u5316<\/p>\n<\/td>\n<td width=\"319\">\n<p style=\"text-align:right\">\u65b0\u9875\u9762\u5165\u6808<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td width=\"180\">\n<p style=\"text-align:left\">\u6253\u5f00\u65b0\u9875\u9762<\/p>\n<\/td>\n<td width=\"319\">\n<p style=\"text-align:right\">\u65b0\u9875\u9762\u5165\u6808<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p style=\"text-align:left\">\u9875\u9762\u91cd\u5b9a\u5411<\/p>\n<\/td>\n<td>\n<p style=\"text-align:right\"><\/p>\n<p style=\"text-align:left\">\u5f53\u524d\u9875\u9762\u51fa\u6808\uff0c<\/p>\n<p style=\"text-align:left\">\u65b0\u9875\u9762\u5165\u6808<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p style=\"text-align:left\">\u9875\u9762\u8fd4\u56de<\/p>\n<\/td>\n<td width=\"319\">\n<p style=\"text-align:right\"><\/p>\n<p style=\"text-align:left\">\u9875\u9762\u4e0d\u65ad\u51fa\u6808\uff0c\u76f4\u5230\u76ee\u6807\u8fd4\u56de\u9875\u9762\uff0c<\/p>\n<p style=\"text-align:left\">\u65b0\u9875\u9762\u5165\u6808<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p style=\"text-align:left\">Tab \u5207\u6362<\/p>\n<\/td>\n<td>\n<p style=\"text-align:right\"><\/p>\n<p style=\"text-align:left\">\u5f53\u524d\u9875\u9762\u51fa\u6808\uff0c<\/p>\n<p style=\"text-align:left\">\u65b0\u9875\u9762\u5165\u6808<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p style=\"text-align:left\"><span style=\"font-size:24px\">\u56db\u3001\u751f\u547d\u5468\u671f<\/span><br \/><span style=\"font-family:Helvetica Neue, Helvetica, Hiragino Sans GB, Microsoft YaHei, Arial, sans-serif\"><span style=\"color:#3e3e3e\">\u4e0b\u56fe\u8bf4\u660e\u4e86 Page \u5b9e\u4f8b\u7684\u751f\u547d\u5468\u671f\u3002<\/span><\/span><\/p>\n<p style=\"line-height:24px;text-indent:nullem;text-align:left\"><span><\/span><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/\/upload\/image\/873\/231\/643\/1488607970192659.png\" style=\"max-width:90%\" class=\"aligncenter\" title=\"\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u5f00\u53d1\u6559\u7a0b-App()\u548cPage()\u51fd\u6570\u6982\u8ff0\u63d2\u56fe2\" alt=\"\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u5f00\u53d1\u6559\u7a0b-App()\u548cPage()\u51fd\u6570\u6982\u8ff0\u63d2\u56fe2\" \/><\/p>\n<p style=\"text-align:left\"><span style=\"font-size:24px\">\u4e94\uff0c\u9875\u9762\u8def\u7531<\/span><\/p>\n<table style=\"width:98%\">\n<tbody>\n<tr>\n<td width=\"180\"><strong>\u8def\u7531\u65b9\u5f0f<\/strong><\/td>\n<td width=\"240\">\n<p style=\"text-align:right\"><strong>\u8def\u7531\u540e\u9875\u9762<\/strong><\/p>\n<\/td>\n<td width=\"203\">\n<p style=\"text-align:right\"><strong>\u8def\u7531\u524d\u9875\u9762<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td width=\"180\">\n<p style=\"text-align:left\">\u521d\u59cb\u5316<\/p>\n<\/td>\n<td width=\"240\">\n<p style=\"text-align:right\"><\/p>\n<p style=\"text-align:left\">onLoad\uff0c<\/p>\n<p style=\"text-align:left\">onShow<\/p>\n<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td width=\"180\">\u6253\u5f00\u65b0\u9875\u9762<\/td>\n<td width=\"240\">\n<p style=\"text-align:right\"><\/p>\n<p style=\"text-align:left\">onLoad\uff0c<\/p>\n<p style=\"text-align:left\">onShow<\/p>\n<\/td>\n<td width=\"203\">\n<p style=\"text-align:right\">onHide<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td width=\"180\">\n<p style=\"text-align:left\">\u9875\u9762\u91cd\u5b9a\u5411<\/p>\n<\/td>\n<td width=\"240\">\n<p style=\"text-align:right\"><\/p>\n<p style=\"text-align:left\">onLoad\uff0c<\/p>\n<p style=\"text-align:left\">onShow<\/p>\n<\/td>\n<td width=\"203\">\n<p style=\"text-align:right\">onUnload<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td width=\"180\">\n<p style=\"text-align:left\">\u9875\u9762\u8fd4\u56de<\/p>\n<\/td>\n<td width=\"240\">\n<p style=\"text-align:right\">onShow<\/p>\n<\/td>\n<td width=\"203\">\n<p style=\"text-align:right\">onUnload\uff08\u591a\u5c42\u9875\u9762\u8fd4\u56de\u6bcf\u4e2a\u9875\u9762\u90fd\u4f1a\u6309\u987a\u5e8f\u89e6\u53d1onUnload\uff09<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td width=\"180\">\n<p style=\"text-align:left\">Tab \u5207\u6362<\/p>\n<\/td>\n<td width=\"240\">\n<p style=\"text-align:right\"><\/p>\n<p style=\"text-align:left\">\u7b2c\u4e00\u6b21\u6253\u5f00 <\/p>\n<p style=\"text-align:left\">onLoad\uff0conshow\uff1b<\/p>\n<p>\u5426\u5219 onShow<\/td>\n<td width=\"203\">\n<p style=\"text-align:right\">onHide<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u66f4\u591a\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u5f00\u53d1\u6559\u7a0b-App()\u548cPage()\u51fd\u6570\u6982\u8ff0\u76f8\u5173\u6587\u7ae0\u8bf7\u5173\u6ce8PHP\u4e2d\u6587\u7f51\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e00\uff0capp() \u7528\u6765\u6ce8\u518c\u4e00\u4e2a\u5c0f\u7a0b\u5e8f\u3002\u5728\u5c0f\u7a0b\u5e8f\u542f\u52a8\u7684\u65f6\u5019\u8c03\u7528\uff0c\u5e76\u521b\u5efa\u5c0f\u7a0b\u5e8f\uff0c\u76f4\u5230\u9500\u6bc1\u3002\u5728\u6574\u4e2a\u5c0f\u7a0b\u5e8f\u7684\u751f\u547d\u5468\u671f\u8fc7\u7a0b\u4e2d\uff0c\u5b83\u90fd\u662f\u5b58\u5728\u7684\u3002\u5f88\u663e\u7136\u5b83\u662f\u5355\u4f8b\u7684\uff0c\u5168\u5c40\u7684\u3002\u6240\u4ee5\uff0c 1\uff09\u53ea\u80fd\u5728app.js\u4e2d\u6ce8\u518c\u4e00\u6b21\u3002 2\uff09\u5728\u4ee3\u7801\u7684\u4efb\u4f55\u5730\u65b9\u90fd\u53ef\u4ee5\u901a\u8fc7 getApp() \u83b7\u53d6\u8fd9\u4e2a\u552f\u4e00\u7684\u5c0f\u7a0b\u5e8f\u5355\u4f8b\uff0c \u6bd4\u5982 var appInstance = getApp(); App()\u7684\u53c2\u6570\u662f object \u7c7b\u578b {} \uff0c\u6307\u5b9a\u4e86\u5c0f\u7a0b\u5e8f\u7684\u58f0\u660e\u5468\u671f\u51fd\u6570\u3002 onLaunch \u51fd\u6570 \u76d1\u542c\u5c0f\u7a0b\u5e8f\u521d\u59cb\u5316\u3002 \u5f53\u5c0f\u7a0b\u5e8f\u521d\u59cb\u5316\u5b8c\u6210\u65f6\uff0c\u4f1a\u89e6\u53d1 onLaunch\uff08\u5168\u5c40\u53ea\u89e6\u53d1\u4e00\u6b21\uff09\u3002 onShow \u51fd\u6570 \u76d1\u542c\u5c0f\u7a0b\u5e8f\u663e\u793a\u3002 \u5f53\u5c0f\u7a0b\u5e8f\u542f\u52a8\uff0c\u6216\u4ece\u540e\u53f0\u8fdb\u5165\u524d\u53f0\u663e\u793a\uff0c\u4f1a\u89e6\u53d1\u3002 onHide \u51fd\u6570&nbsp;&nbsp; \u76d1\u542c\u5c0f\u7a0b\u5e8f\u9690\u85cf\u3002 \u5f53\u5c0f\u7a0b\u5e8f\u4ece\u524d\u53f0\u8fdb\u5165\u540e\u53f0\uff0c\u4f1a\u89e6\u53d1\u3002 \u6240\u8c13\u524d\u540e\u53f0\u7684\u5b9a\u4e49\uff0c\u7c7b\u4f3c\u4e8e\u624b\u673a\u4e0a\u7684app\uff0c\u6bd4\u5982\u5f53\u4e0d\u5728\u4f7f\u7528\u5fae\u4fe1\u65f6\uff0c\u5c31\u8fdb\u5165\u4e86\u540e\u53f0\u3002 globalData \u5bf9\u8c61 \u5168\u5c40\u6570\u636e\u3002 \u4ee3\u7801\u548c\u65e5\u5fd7\u53c2\u8003\uff0c\u5982\u4e0b\u52a8\u56fe\uff1a \u4e8c\u3001Page()\u51fd\u6570 \u901a\u8fc7App()\u6ce8\u518c\u5b8c\u6210\u5c0f\u7a0b\u5e8f\u4e4b\u540e\uff0c\u6846\u67b6\u5c31\u5f00\u59cb\u6ce8\u518c\u9875\u9762\u3002\u6240\u4ee5\u4e0d\u8981\u5728App()\u7684 onLaunch \u4e2d\u8c03\u7528 getCurrentPage() \u65b9\u6cd5\uff0c\u56e0\u4e3a\u6b64\u65f6\u9875\u9762\u8fd8\u6ca1\u6709\u6ce8\u518c\u5b8c\u6210\u3002 \u540c\u6837\u7684Page()\u4e5f\u662f\u6709\u751f\u547d\u5468\u671f\u7684\u3002\u5f53\u9875\u9762\u6ce8\u518c\u5b8c\u6210\u4e4b\u540e\uff0c\u53ef\u4ee5\u5728 page.js \u6587\u4ef6\u4e2d\u8c03\u7528 getCurrentPage() \u65b9\u6cd5\uff0c\u83b7\u53d6\u5f53\u524d\u9875\u9762\u5bf9\u8c61\u3002 2.1\uff0cPage()\u7684\u53c2\u6570\u4e5f\u662fObject\u7c7b\u578b\u3002onLoad&nbsp;&nbsp;\u76d1\u542c\u9875\u9762\u52a0\u8f7d \u9875\u9762\u521a\u5f00\u59cb\u52a0\u8f7d\u7684\u65f6\u5019\u89e6\u53d1\u3002\u53ea\u4f1a\u8c03\u7528\u4e00\u6b21\u3002 onReady \u76d1\u542c\u9875\u9762\u521d\u6b21\u6e32\u67d3\u5b8c\u6210 \u7c7b\u4f3c\u4e8ehtml\u7684 onReady\u3002\u53ea\u4f1a\u8c03\u7528\u4e00\u6b21\u3002 onShow&nbsp;&nbsp;\u76d1\u542c\u9875\u9762\u663e\u793a \u9875\u9762\u663e\u793a\u7684\u65f6\u5019\u89e6\u53d1\uff0c\u6bd4\u5982\u9875\u9762\u5207\u6362 onHide \u76d1\u542c\u9875\u9762\u9690\u85cf [&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-28644","post","type-post","status-publish","format-standard","hentry","category-19"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/28644","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=28644"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/28644\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=28644"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=28644"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=28644"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}