{"id":33904,"date":"2024-11-25T17:10:00","date_gmt":"2024-11-25T09:10:00","guid":{"rendered":"https:\/\/fwq.ai\/blog\/33904\/"},"modified":"2024-11-25T17:10:00","modified_gmt":"2024-11-25T09:10:00","slug":"%e5%b0%8f%e7%a8%8b%e5%ba%8f%e7%94%9f%e5%91%bd%e5%91%a8%e6%9c%9f%e5%87%bd%e6%95%b0%e6%9c%89%e5%93%aa%e4%ba%9b","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/33904\/","title":{"rendered":"\u5c0f\u7a0b\u5e8f\u751f\u547d\u5468\u671f\u51fd\u6570\u6709\u54ea\u4e9b"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202103\/05\/2021030509352363390.jpg\" class=\"aligncenter\" title=\"\u5c0f\u7a0b\u5e8f\u751f\u547d\u5468\u671f\u51fd\u6570\u6709\u54ea\u4e9b\u63d2\u56fe\" alt=\"\u5c0f\u7a0b\u5e8f\u751f\u547d\u5468\u671f\u51fd\u6570\u6709\u54ea\u4e9b\u63d2\u56fe\" \/><\/p>\n<p>\u5bfc\u8bed\uff1a<\/p>\n<p>\u6700\u8fd1\u521a\u63a5\u89e6\u5230\u5c0f\u7a0b\u5e8f\uff0c\u5728\u6d4b\u8bd5\u65f6\u53d1\u73b0\u9000\u51fa\u5c0f\u7a0b\u5e8f\u540e\u5c0f\u7a0b\u5e8f\u4e2d\u7684\u6570\u636e\u5e76\u6ca1\u6709\u5f97\u5230\u91ca\u653e\uff0c\u56e0\u6b64\u5f53\u6211\u518d\u6b21\u6253\u5f00\u5c0f\u6570\u636e\u65f6\uff0c\u6570\u636e\u5e76\u6ca1\u6709\u5f97\u5230\u521d\u59cb\u5316\u3002\u90a3\u4e48\u6211\u4eec\u8be5\u5982\u4f55\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\u5462\uff1f<\/p>\n<p>\u89e3\u51b3\u601d\u8def\uff1a<\/p>\n<p>\u9996\u5148\u5728\u5c0f\u7a0b\u5e8fdata\u6570\u636e\u4e2d\u58f0\u660e\u4e00\u4e2a\u53d8\u91cfisClose\uff0c\u9ed8\u8ba4\u4e3atrue\uff0c\u7528\u4e8e\u5224\u65ad\u662f\u5426\u662f\u4ece\u5c0f\u7a0b\u5e8f\u5165\u53e3\u6253\u5f00\u3002\u5f53\u7528\u6237\u70b9\u51fb\u8df3\u8f6c\u9875\u9762\u6216\u5173\u95ed\u5c0f\u7a0b\u5e8f\u65f6\uff0c\u4f1a\u89e6\u53d1OnHide\u51fd\u6570\uff0c\u6b64\u65f6\uff0c\u5728\u8be5\u51fd\u6570\u4e2d\u5c06\u5224\u65adisClose isTrue\uff0c\u8868\u793a\u5173\u95ed\u4e4b\u540e\u518d\u6253\u5f00\u3002\u5f53\u9875\u9762\u8df3\u8f6c\u65f6\uff0c\u9996\u5148\u4f1a\u5c06isClose\u8bbe\u7f6e\u4e3afalse\uff0c\u8fd9\u6837\u89e6\u53d1OnHide\u51fd\u6570\u65f6\uff0cisClose is false \u5e76\u4e0d\u4f1a\u6267\u884c\uff0c\u7136\u540e\u8fdb\u5165\u8df3\u8f6c\u7684\u9875\u9762\uff0c\u518d\u7531\u9875\u9762\u8fdb\u884c\u8fd4\u56de\u3002<\/p>\n<p>\u5728OnUnload\u51fd\u6570\u4e2d\uff0c\u8bbe\u7f6e\u4e00\u4e2a\u5b9a\u65f6\u5668\uff0c200ms\u4e4b\u540e\u5c06isClose\u6539\u4e3atrue\uff0c\u8fd9\u6837\u5f53\u5173\u95ed\u5c0f\u7a0b\u5e8f\u5e76\u518d\u6b21\u8fdb\u5165\u65f6\uff0cisClose\u4f9d\u7136\u4e3atrue\uff0c\u5224\u65ad\u4e3a\u9996\u6b21\u8fdb\u5165\u9875\u9762\u3002<\/p>\n<p>\u5c0f\u7a0b\u5e8f\u7684\u751f\u547d\u5468\u671f\u51fd\u6570\u5982\u4e0b\uff1a<\/p>\n<p>1.1 \u76d1\u542c\u9875\u9762\u52a0\u8f7d<\/p>\n<pre>onLoad:&nbsp;function&nbsp;(options)&nbsp;{},<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u4e00\u4e2a\u9875\u9762\u53ea\u4f1a\u8c03\u7528\u4e00\u6b21\uff0c\u53ef\u4ee5\u5728 onLoad \u4e2d\u83b7\u53d6\u6253\u5f00\u5f53\u524d\u9875\u9762\u6240\u8c03\u7528\u7684 query \u53c2\u6570\u3002&nbsp;<\/p>\n<p>1.2 \u76d1\u542c\u9875\u9762\u521d\u6b21\u6e32\u67d3\u5b8c\u6210<\/p>\n<pre>onReady:&nbsp;function&nbsp;()&nbsp;{},<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u4e00\u4e2a\u9875\u9762\u53ea\u4f1a\u8c03\u7528\u4e00\u6b21\uff0c\u4ee3\u8868\u9875\u9762\u5df2\u7ecf\u51c6\u5907\u59a5\u5f53\uff0c\u53ef\u4ee5\u548c\u89c6\u56fe\u5c42\u8fdb\u884c\u4ea4\u4e92\u3002&nbsp;<\/p>\n<p>1.3 \u76d1\u542c\u9875\u9762\u663e\u793a&nbsp;<\/p>\n<pre>onShow:&nbsp;function&nbsp;()&nbsp;{},<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u6bcf\u6b21\u6253\u5f00\u9875\u9762\u90fd\u4f1a\u8c03\u7528\u4e00\u6b21\u3002&nbsp;<\/p>\n<p>1.3 \u76d1\u542c\u9875\u9762\u9690\u85cf<\/p>\n<pre>onHide:&nbsp;function&nbsp;()&nbsp;{},<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u5f53navigateTo\u6216\u5e95\u90e8tab\u5207\u6362\u65f6\u8c03\u7528\u3002&nbsp;<\/p>\n<p>\uff08\u5b66\u4e60\u89c6\u9891\u5206\u4eab\uff1a\uff09<\/p>\n<p>1.4 \u76d1\u542c\u9875\u9762\u5378\u8f7d<\/p>\n<pre>onUnload:&nbsp;function&nbsp;()&nbsp;{},<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u5f53redirectTo\u6216navigateBack\u7684\u65f6\u5019\u8c03\u7528\u3002&nbsp;<\/p>\n<p>\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u7684 app.js \u4e2d\u72ec\u6709\u7684\u51fd\u6570<\/p>\n<p>2.1 \u76d1\u542c\u5c0f\u7a0b\u5e8f\u521d\u59cb\u5316<\/p>\n<pre>onLaunch:function&nbsp;()&nbsp;{},<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u5f53\u5c0f\u7a0b\u5e8f\u521d\u59cb\u5316\u5b8c\u6210\u65f6\uff0c\u4f1a\u89e6\u53d1 onLaunch\uff08\u5168\u5c40\u53ea\u89e6\u53d1\u4e00\u6b21\uff09&nbsp;<\/p>\n<p>2.2 \u9519\u8bef\u76d1\u542c\u51fd\u6570<\/p>\n<pre>onError:function&nbsp;()&nbsp;{},<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u5f53\u5c0f\u7a0b\u5e8f\u53d1\u751f\u811a\u672c\u9519\u8bef\uff0c\u6216\u8005 api \u8c03\u7528\u5931\u8d25\u65f6\uff0c\u4f1a\u89e6\u53d1 onError \u5e76\u5e26\u4e0a\u9519\u8bef\u4fe1\u606f<\/p>\n<p>\u76f8\u5173\u63a8\u8350\uff1a<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u5c0f\u7a0b\u5e8f\u751f\u547d\u5468\u671f\u51fd\u6570\u6709\u54ea\u4e9b\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>\u5bfc\u8bed\uff1a \u6700\u8fd1\u521a\u63a5\u89e6\u5230\u5c0f\u7a0b\u5e8f\uff0c\u5728\u6d4b\u8bd5\u65f6\u53d1\u73b0\u9000\u51fa\u5c0f\u7a0b\u5e8f\u540e\u5c0f\u7a0b\u5e8f\u4e2d\u7684\u6570\u636e\u5e76\u6ca1\u6709\u5f97\u5230\u91ca\u653e\uff0c\u56e0\u6b64\u5f53\u6211\u518d\u6b21\u6253\u5f00\u5c0f\u6570\u636e\u65f6\uff0c\u6570\u636e\u5e76\u6ca1\u6709\u5f97\u5230\u521d\u59cb\u5316\u3002\u90a3\u4e48\u6211\u4eec\u8be5\u5982\u4f55\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\u5462\uff1f \u89e3\u51b3\u601d\u8def\uff1a \u9996\u5148\u5728\u5c0f\u7a0b\u5e8fdata\u6570\u636e\u4e2d\u58f0\u660e\u4e00\u4e2a\u53d8\u91cfisClose\uff0c\u9ed8\u8ba4\u4e3atrue\uff0c\u7528\u4e8e\u5224\u65ad\u662f\u5426\u662f\u4ece\u5c0f\u7a0b\u5e8f\u5165\u53e3\u6253\u5f00\u3002\u5f53\u7528\u6237\u70b9\u51fb\u8df3\u8f6c\u9875\u9762\u6216\u5173\u95ed\u5c0f\u7a0b\u5e8f\u65f6\uff0c\u4f1a\u89e6\u53d1OnHide\u51fd\u6570\uff0c\u6b64\u65f6\uff0c\u5728\u8be5\u51fd\u6570\u4e2d\u5c06\u5224\u65adisClose isTrue\uff0c\u8868\u793a\u5173\u95ed\u4e4b\u540e\u518d\u6253\u5f00\u3002\u5f53\u9875\u9762\u8df3\u8f6c\u65f6\uff0c\u9996\u5148\u4f1a\u5c06isClose\u8bbe\u7f6e\u4e3afalse\uff0c\u8fd9\u6837\u89e6\u53d1OnHide\u51fd\u6570\u65f6\uff0cisClose is false \u5e76\u4e0d\u4f1a\u6267\u884c\uff0c\u7136\u540e\u8fdb\u5165\u8df3\u8f6c\u7684\u9875\u9762\uff0c\u518d\u7531\u9875\u9762\u8fdb\u884c\u8fd4\u56de\u3002 \u5728OnUnload\u51fd\u6570\u4e2d\uff0c\u8bbe\u7f6e\u4e00\u4e2a\u5b9a\u65f6\u5668\uff0c200ms\u4e4b\u540e\u5c06isClose\u6539\u4e3atrue\uff0c\u8fd9\u6837\u5f53\u5173\u95ed\u5c0f\u7a0b\u5e8f\u5e76\u518d\u6b21\u8fdb\u5165\u65f6\uff0cisClose\u4f9d\u7136\u4e3atrue\uff0c\u5224\u65ad\u4e3a\u9996\u6b21\u8fdb\u5165\u9875\u9762\u3002 \u5c0f\u7a0b\u5e8f\u7684\u751f\u547d\u5468\u671f\u51fd\u6570\u5982\u4e0b\uff1a 1.1 \u76d1\u542c\u9875\u9762\u52a0\u8f7d onLoad:&nbsp;function&nbsp;(options)&nbsp;{}, \u767b\u5f55\u540e\u590d\u5236 \u4e00\u4e2a\u9875\u9762\u53ea\u4f1a\u8c03\u7528\u4e00\u6b21\uff0c\u53ef\u4ee5\u5728 onLoad \u4e2d\u83b7\u53d6\u6253\u5f00\u5f53\u524d\u9875\u9762\u6240\u8c03\u7528\u7684 query \u53c2\u6570\u3002&nbsp; 1.2 \u76d1\u542c\u9875\u9762\u521d\u6b21\u6e32\u67d3\u5b8c\u6210 onReady:&nbsp;function&nbsp;()&nbsp;{}, \u767b\u5f55\u540e\u590d\u5236 \u4e00\u4e2a\u9875\u9762\u53ea\u4f1a\u8c03\u7528\u4e00\u6b21\uff0c\u4ee3\u8868\u9875\u9762\u5df2\u7ecf\u51c6\u5907\u59a5\u5f53\uff0c\u53ef\u4ee5\u548c\u89c6\u56fe\u5c42\u8fdb\u884c\u4ea4\u4e92\u3002&nbsp; 1.3 \u76d1\u542c\u9875\u9762\u663e\u793a&nbsp; onShow:&nbsp;function&nbsp;()&nbsp;{}, \u767b\u5f55\u540e\u590d\u5236 \u6bcf\u6b21\u6253\u5f00\u9875\u9762\u90fd\u4f1a\u8c03\u7528\u4e00\u6b21\u3002&nbsp; 1.3 \u76d1\u542c\u9875\u9762\u9690\u85cf onHide:&nbsp;function&nbsp;()&nbsp;{}, \u767b\u5f55\u540e\u590d\u5236 \u5f53navigateTo\u6216\u5e95\u90e8tab\u5207\u6362\u65f6\u8c03\u7528\u3002&nbsp; \uff08\u5b66\u4e60\u89c6\u9891\u5206\u4eab\uff1a\uff09 1.4 \u76d1\u542c\u9875\u9762\u5378\u8f7d onUnload:&nbsp;function&nbsp;()&nbsp;{}, \u767b\u5f55\u540e\u590d\u5236 \u5f53redirectTo\u6216navigateBack\u7684\u65f6\u5019\u8c03\u7528\u3002&nbsp; \u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u7684 app.js \u4e2d\u72ec\u6709\u7684\u51fd\u6570 2.1 \u76d1\u542c\u5c0f\u7a0b\u5e8f\u521d\u59cb\u5316 onLaunch:function&nbsp;()&nbsp;{}, \u767b\u5f55\u540e\u590d\u5236 \u5f53\u5c0f\u7a0b\u5e8f\u521d\u59cb\u5316\u5b8c\u6210\u65f6\uff0c\u4f1a\u89e6\u53d1 onLaunch\uff08\u5168\u5c40\u53ea\u89e6\u53d1\u4e00\u6b21\uff09&nbsp; 2.2 \u9519\u8bef\u76d1\u542c\u51fd\u6570 onError:function&nbsp;()&nbsp;{}, \u767b\u5f55\u540e\u590d\u5236 \u5f53\u5c0f\u7a0b\u5e8f\u53d1\u751f\u811a\u672c\u9519\u8bef\uff0c\u6216\u8005 api [&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-33904","post","type-post","status-publish","format-standard","hentry","category-19"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/33904","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=33904"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/33904\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=33904"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=33904"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=33904"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}