{"id":31263,"date":"2024-11-25T16:35:49","date_gmt":"2024-11-25T08:35:49","guid":{"rendered":"https:\/\/fwq.ai\/blog\/31263\/"},"modified":"2024-11-25T16:35:49","modified_gmt":"2024-11-25T08:35:49","slug":"%e5%be%ae%e4%bf%a1%e5%b0%8f%e7%a8%8b%e5%ba%8f%e9%a1%b5%e9%9d%a2%e8%b7%b3%e8%bd%ac%e4%ba%8b%e4%bb%b6%e7%bb%91%e5%ae%9a%e5%ae%9e%e4%be%8b%e8%af%a6%e8%a7%a3","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/31263\/","title":{"rendered":"\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u9875\u9762\u8df3\u8f6c\u4e8b\u4ef6\u7ed1\u5b9a\u5b9e\u4f8b\u8be6\u89e3"},"content":{"rendered":"<p>\u672c\u6587\u4e3b\u8981\u548c\u5927\u5bb6\u4ecb\u7ecd\u5fae\u4fe1\u5c0f\u7a0b\u5e8f \u9875\u9762\u8df3\u8f6c\u4e8b\u4ef6\u7ed1\u5b9a\u7684\u5b9e\u4f8b\u8be6\u89e3\u7684\u76f8\u5173\u8d44\u6599,\u5e0c\u671b\u901a\u8fc7\u672c\u6587\u5927\u5bb6\u80fd\u591f\u7406\u89e3\u5e76\u5e94\u7528\u5c0f\u7a0b\u5e8f\u9875\u9762\u8df3\u8f6c\u53ca\u4e8b\u4ef6\u7ed1\u5b9a\u7684\u5b9e\u4f8b\uff0c\u9700\u8981\u7684\u670b\u53cb\u53ef\u4ee5\u53c2\u8003\u4e0b\uff0c\u5e0c\u671b\u80fd\u5e2e\u52a9\u5230\u5927\u5bb6\u3002<\/p>\n<p>\u5fae\u4fe1\u5c0f\u7a0b\u5e8f \u9875\u9762\u8df3\u8f6c\u4e8b\u4ef6\u7ed1\u5b9a\u7684\u5b9e\u4f8b\u8be6\u89e3<\/p>\n<p>\u4ec0\u4e48\u662f\u4e8b\u4ef6<\/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\u884c\u4e3a\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\u5982 id, dataset, touches\u3002<\/p>\n<\/li>\n<\/ol>\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<\/p>\n<pre> &lt;view bindtap=\"view\"&gt;\r\n    &lt;text bindtap=\"toast\" class=\"journey\"&gt;\u5f00\u542f\u5c0f\u7a0b\u5e8f\u4e4b\u65c5   &lt;\/text&gt;\r\n &lt;\/view&gt;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u5b50\u5143\u7d20\u89e6\u53d1\u7236\u7ea7\u5143\u7d20\u4e5f\u4f1a\u89e6\u53d1\u82e5\u8981\u53ea\u89e6\u53d1\u5b50\u5143\u7d20\u4f7f\u7528catchtap\u4ee3\u66ffbindtap<\/p>\n<p>\u5728\u76f8\u5e94\u7684Page\u5b9a\u4e49\u4e2d\u5199\u4e0a\u76f8\u5e94\u7684\u4e8b\u4ef6\u5904\u7406\u51fd\u6570\uff0c\u53c2\u6570\u662fevent\u3002<\/p>\n<pre>Page({\r\n toast: function (event) {\r\n  \/\/ wx.navigateTo({\r\n  \/\/  url: '..\/redirect\/redirect'\r\n  \/\/ });\r\n\r\n\r\n  wx.redirectTo({\r\n   url: '..\/redirect\/redirect',\r\n  });\r\n  \/\/ view:function(event){\r\n  \/\/  \/\/ \u7236\u7ea7\u5143\u7d20\r\n  \/\/ }\r\n\r\n },\r\n \/**\r\n   * \u751f\u547d\u5468\u671f\u51fd\u6570--\u76d1\u542c\u9875\u9762\u9690\u85cf\/\u5e76\u672a\u5173\u95ed\u8fd4\u56de\r\n   *\/\r\n onHide: function (event) {\r\n   console.log(event)\r\n },\r\n\r\n \/**\r\n  * \u751f\u547d\u5468\u671f\u51fd\u6570--\u76d1\u542c\u9875\u9762\u5378\u8f7d\/\r\n  *\/\r\n onUnload: function () {\r\n  console.log(222)\r\n },\r\n})<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u4e8b\u4ef6\u5206\u7c7b<\/p>\n<p>\u5192\u6ce1\u4e8b\u4ef6\uff1a\u5f53\u4e00\u4e2a\u7ec4\u4ef6\u4e0a\u7684\u4e8b\u4ef6\u88ab\u89e6\u53d1\u540e\uff0c\u8be5\u4e8b\u4ef6\u4f1a\u5411\u7236\u8282\u70b9\u4f20\u9012\u3002 <\/p>\n<p>\u975e\u5192\u6ce1\u4e8b\u4ef6\uff1a\u5f53\u4e00\u4e2a\u7ec4\u4ef6\u4e0a\u7684\u4e8b\u4ef6\u88ab\u89e6\u53d1\u540e\uff0c\u8be5\u4e8b\u4ef6\u4e0d\u4f1a\u5411\u7236\u8282\u70b9\u4f20\u9012\u3002<\/p>\n<p>WXML\u7684\u5192\u6ce1\u4e8b\u4ef6\u5217\u8868\uff1a<\/p>\n<pre>\u7c7b\u578b \u89e6\u53d1\u6761\u4ef6\r\ntouchstart \u624b\u6307\u89e6\u6478\u52a8\u4f5c\u5f00\u59cb\r\ntouchmove  \u624b\u6307\u89e6\u6478\u540e\u79fb\u52a8\r\ntouchcancel \u624b\u6307\u89e6\u6478\u52a8\u4f5c\u88ab\u6253\u65ad\uff0c\u5982\u6765\u7535\u63d0\u9192\uff0c\u5f39\u7a97\r\ntouchend  \u624b\u6307\u89e6\u6478\u52a8\u4f5c\u7ed3\u675f\r\ntap \u624b\u6307\u89e6\u6478\u540e\u9a6c\u4e0a\u79bb\u5f00\r\nlongtap \u624b\u6307\u89e6\u6478\u540e\uff0c\u8d85\u8fc7350ms\u518d\u79bb\u5f00<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u6ce8\uff1a\u9664\u4e0a\u8868\u4e4b\u5916\u7684\u5176\u4ed6\u7ec4\u4ef6\u81ea\u5b9a\u4e49\u4e8b\u4ef6\u5982\u65e0\u7279\u6b8a\u7533\u660e\u90fd\u662f\u975e\u5192\u6ce1\u4e8b\u4ef6\uff0c\u5982<\/p>\n<p> \u7684submit\u4e8b\u4ef6\uff0c \u7684input\u4e8b\u4ef6\uff0c \u7684scroll\u4e8b\u4ef6\uff0c(\u8be6\u89c1\u5404\u4e2a\u7ec4\u4ef6\u5b98\u65b9\u6587\u6863)<br \/>\n <\/p>\n<p>\u76f8\u5173\u63a8\u8350\uff1a<\/p>\n<\/p>\n<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u9875\u9762\u8df3\u8f6c\u4e8b\u4ef6\u7ed1\u5b9a\u5b9e\u4f8b\u8be6\u89e3\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>\u672c\u6587\u4e3b\u8981\u548c\u5927\u5bb6\u4ecb\u7ecd\u5fae\u4fe1\u5c0f\u7a0b\u5e8f \u9875\u9762\u8df3\u8f6c\u4e8b\u4ef6\u7ed1\u5b9a\u7684\u5b9e\u4f8b\u8be6\u89e3\u7684\u76f8\u5173\u8d44\u6599,\u5e0c\u671b\u901a\u8fc7\u672c\u6587\u5927\u5bb6\u80fd\u591f\u7406\u89e3\u5e76\u5e94\u7528\u5c0f\u7a0b\u5e8f\u9875\u9762\u8df3\u8f6c\u53ca\u4e8b\u4ef6\u7ed1\u5b9a\u7684\u5b9e\u4f8b\uff0c\u9700\u8981\u7684\u670b\u53cb\u53ef\u4ee5\u53c2\u8003\u4e0b\uff0c\u5e0c\u671b\u80fd\u5e2e\u52a9\u5230\u5927\u5bb6\u3002 \u5fae\u4fe1\u5c0f\u7a0b\u5e8f \u9875\u9762\u8df3\u8f6c\u4e8b\u4ef6\u7ed1\u5b9a\u7684\u5b9e\u4f8b\u8be6\u89e3 \u4ec0\u4e48\u662f\u4e8b\u4ef6 \u4e8b\u4ef6\u662f\u89c6\u56fe\u5c42\u5230\u903b\u8f91\u5c42\u7684\u901a\u8baf\u65b9\u5f0f\u3002 \u4e8b\u4ef6\u53ef\u4ee5\u5c06\u7528\u6237\u7684\u884c\u4e3a\u53cd\u9988\u5230\u903b\u8f91\u5c42\u8fdb\u884c\u5904\u7406\u3002 \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 \u4e8b\u4ef6\u5bf9\u8c61\u53ef\u4ee5\u643a\u5e26\u989d\u5916\u4fe1\u606f\uff0c\u5982 id, dataset, touches\u3002 \u5728\u7ec4\u4ef6\u4e2d\u7ed1\u5b9a\u4e00\u4e2a\u4e8b\u4ef6\u5904\u7406\u51fd\u6570\u3002 \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 &lt;view bindtap=&#8221;view&#8221;&gt; &lt;text bindtap=&#8221;toast&#8221; class=&#8221;journey&#8221;&gt;\u5f00\u542f\u5c0f\u7a0b\u5e8f\u4e4b\u65c5 &lt;\/text&gt; &lt;\/view&gt; \u767b\u5f55\u540e\u590d\u5236 \u5b50\u5143\u7d20\u89e6\u53d1\u7236\u7ea7\u5143\u7d20\u4e5f\u4f1a\u89e6\u53d1\u82e5\u8981\u53ea\u89e6\u53d1\u5b50\u5143\u7d20\u4f7f\u7528catchtap\u4ee3\u66ffbindtap \u5728\u76f8\u5e94\u7684Page\u5b9a\u4e49\u4e2d\u5199\u4e0a\u76f8\u5e94\u7684\u4e8b\u4ef6\u5904\u7406\u51fd\u6570\uff0c\u53c2\u6570\u662fevent\u3002 Page({ toast: function (event) { \/\/ wx.navigateTo({ \/\/ url: &#8216;..\/redirect\/redirect&#8217; \/\/ }); wx.redirectTo({ url: &#8216;..\/redirect\/redirect&#8217;, }); \/\/ view:function(event){ \/\/ \/\/ \u7236\u7ea7\u5143\u7d20 \/\/ } }, \/** * \u751f\u547d\u5468\u671f\u51fd\u6570&#8211;\u76d1\u542c\u9875\u9762\u9690\u85cf\/\u5e76\u672a\u5173\u95ed\u8fd4\u56de *\/ onHide: function (event) [&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-31263","post","type-post","status-publish","format-standard","hentry","category-19"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/31263","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=31263"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/31263\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=31263"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=31263"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=31263"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}