{"id":114802,"date":"2026-10-10T09:41:19","date_gmt":"2026-10-10T01:41:19","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/114802.html"},"modified":"2026-10-10T09:41:19","modified_gmt":"2026-10-10T01:41:19","slug":"%e9%9d%a2%e8%af%95%e5%ae%98%e9%97%ae%e6%88%91%ef%bc%9a%e5%b0%8f%e7%a8%8b%e5%ba%8f%e6%b2%a1%e6%9c%89-dom%ef%bc%8creact-%e7%9a%84-e-stoppropagation-%e4%b8%ba%e4%bb%80%e4%b9%88%e8%bf%98%e8%83%bd","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/114802.html","title":{"rendered":"\u9762\u8bd5\u5b98\u95ee\u6211\uff1a\u5c0f\u7a0b\u5e8f\u6ca1\u6709 DOM\uff0cReact \u7684 e.stopPropagation() \u4e3a\u4ec0\u4e48\u8fd8\u80fd\u751f\u6548\uff1f\u6211\u5f53\u573a\u8bb2\u900f\u4e86\u8fd9\u5957\u5408\u6210\u4e8b\u4ef6\u7cfb\u7edf"},"content":{"rendered":"<p>\u8bf4\u660e&#xff1a;\u672c\u6587\u5206\u6790\u5bf9\u8c61\u4e3a\u5f00\u6e90\u9879\u76ee&#xff0c;\u51fa\u4e8e\u5408\u89c4\u8003\u8651&#xff0c;\u6587\u4e2d\u4ee5\u300c\u8de8\u7aef\u6846\u67b6 A\u300d&#xff08;\u4e00\u5957\u4ee3\u7801\u7f16\u8bd1\u5230\u591a\u7aef\u7684\u6846\u67b6&#xff09;\u3001\u300c\u539f\u751f\u7ec4\u4ef6\u5e93 B\u300d&#xff08;\u67d0\u5c0f\u7a0b\u5e8f\u5e73\u53f0\u5b98\u65b9 UI \u7ec4\u4ef6\u5e93&#xff09;\u7b49\u4ee3\u79f0\u6307\u4ee3&#xff0c;\u4ee3\u7801\u5747\u4e3a\u91cd\u5199\u540e\u7684\u7b80\u5316\u4f2a\u4ee3\u7801&#xff0c;\u4ec5\u7528\u4e8e\u8bf4\u660e\u8bbe\u8ba1\u601d\u8def&#xff0c;\u4e0e\u771f\u5b9e\u6e90\u7801\u5b58\u5728\u5dee\u5f02\u3002<\/p>\n<hr \/>\n<h3>\u5f15\u8a00&#xff1a;\u4f60\u5728 React \u91cc\u5199\u7684 e.stopPropagation()&#xff0c;\u4e3a\u4ec0\u4e48\u5728\u5c0f\u7a0b\u5e8f\u91cc\u4e5f\u80fd\u751f\u6548<\/h3>\n<p>\u5148\u770b\u4e00\u6bb5\u6bcf\u4e2a React \u5f00\u53d1\u8005\u90fd\u5199\u8fc7\u7684\u4ee3\u7801&#xff1a;<\/p>\n<p><span class=\"token comment\">\/\/ \u4e1a\u52a1\u4ee3\u7801&#xff1a;\u70b9\u51fb\u5217\u8868\u9879&#xff0c;\u540c\u65f6\u963b\u6b62\u5916\u5c42\u5bb9\u5668\u7684\u70b9\u51fb\u903b\u8f91<\/span><br \/>\n<span class=\"token keyword\">function<\/span> <span class=\"token function\">ListItem<\/span><span class=\"token punctuation\">(<\/span><span class=\"token parameter\"><span class=\"token punctuation\">{<\/span> item<span class=\"token punctuation\">,<\/span> onSelect <span class=\"token punctuation\">}<\/span><\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n  <span class=\"token keyword\">return<\/span> <span class=\"token punctuation\">(<\/span><br \/>\n    <span class=\"token operator\">&lt;<\/span>view onClick<span class=\"token operator\">&#061;<\/span><span class=\"token punctuation\">{<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token operator\">&#061;&gt;<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n      <span class=\"token function\">onSelect<\/span><span class=\"token punctuation\">(<\/span>item<span class=\"token punctuation\">)<\/span><br \/>\n    <span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">}<\/span><span class=\"token operator\">&gt;<\/span><br \/>\n      <span class=\"token operator\">&lt;<\/span>view className<span class=\"token operator\">&#061;<\/span><span class=\"token string\">&#034;delete&#034;<\/span> onClick<span class=\"token operator\">&#061;<\/span><span class=\"token punctuation\">{<\/span><span class=\"token punctuation\">(<\/span><span class=\"token parameter\">e<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token operator\">&#061;&gt;<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n        e<span class=\"token punctuation\">.<\/span><span class=\"token function\">stopPropagation<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span>   <span class=\"token comment\">\/\/ \u2190 \u5173\u952e&#xff1a;\u963b\u6b62\u5192\u6ce1<\/span><br \/>\n        <span class=\"token function\">onDelete<\/span><span class=\"token punctuation\">(<\/span>item<span class=\"token punctuation\">)<\/span><br \/>\n      <span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">}<\/span><span class=\"token operator\">&gt;<\/span>\u5220\u9664<span class=\"token operator\">&lt;<\/span><span class=\"token operator\">\/<\/span>view<span class=\"token operator\">&gt;<\/span><br \/>\n      <span class=\"token operator\">&lt;<\/span>text<span class=\"token operator\">&gt;<\/span><span class=\"token punctuation\">{<\/span>item<span class=\"token punctuation\">.<\/span>name<span class=\"token punctuation\">}<\/span><span class=\"token operator\">&lt;<\/span><span class=\"token operator\">\/<\/span>text<span class=\"token operator\">&gt;<\/span><br \/>\n    <span class=\"token operator\">&lt;<\/span><span class=\"token operator\">\/<\/span>view<span class=\"token operator\">&gt;<\/span><br \/>\n  <span class=\"token punctuation\">)<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p>\u628a\u8fd9\u6bb5\u4ee3\u7801\u653e\u8fdb\u6d4f\u89c8\u5668&#xff0c;e.stopPropagation() \u5929\u7ecf\u5730\u4e49\u2014\u2014\u56e0\u4e3a\u6d4f\u89c8\u5668\u6709 DOM&#xff0c;\u4e8b\u4ef6\u5929\u7136\u4ece\u6700\u6df1\u7684\u771f\u5b9e\u8282\u70b9\u9010\u7ea7\u5411\u4e0a\u4f20\u64ad&#xff0c;target \u662f\u88ab\u70b9\u7684\u5220\u9664\u6309\u94ae&#xff0c;currentTarget \u662f\u7ed1\u4e86\u56de\u8c03\u7684\u8282\u70b9&#xff0c;\u4e00\u5207\u7531\u6d4f\u89c8\u5668\u5185\u6838\u514d\u8d39\u63d0\u4f9b\u3002<\/p>\n<p>\u95ee\u9898\u6765\u4e86&#xff1a;\u5c0f\u7a0b\u5e8f\u73af\u5883\u91cc\u6ca1\u6709 DOM\u3002 \u53cc\u7ebf\u7a0b\u67b6\u6784\u4e0b&#xff0c;\u903b\u8f91\u5c42\u62ff\u5230\u7684\u4e0d\u662f\u8282\u70b9\u6811&#xff0c;\u800c\u662f\u4e00\u4e2a\u4e2a\u300c\u9875\u9762\/\u7ec4\u4ef6\u5b9e\u4f8b\u300d\u548c\u4e00\u5768 JSON \u5316\u7684\u4e8b\u4ef6\u5bf9\u8c61\u3002\u539f\u751f\u4e8b\u4ef6\u6ca1\u6709 target \u6811\u3001\u6ca1\u6709 currentTarget\u3001\u66f4\u6ca1\u6709\u5192\u6ce1\u94fe\u2014\u2014stopPropagation \u8fd9\u4e2a API \u5728\u539f\u751f\u5c0f\u7a0b\u5e8f\u7684\u4e16\u754c\u91cc\u538b\u6839\u4e0d\u5b58\u5728\u3002<\/p>\n<p>\u4f46\u7528\u8de8\u7aef\u6846\u67b6 A \u5199\u7684\u4e1a\u52a1\u4ee3\u7801&#xff0c;\u4e0a\u9762\u90a3\u6bb5 JSX \u8dd1\u5728\u5c0f\u7a0b\u5e8f\u4e0a\u4e00\u5207\u6b63\u5e38&#xff1a;e.target.dataset \u80fd\u53d6\u5230&#xff0c;e.stopPropagation() \u80fd\u62e6\u4f4f\u7236\u7ea7\u56de\u8c03&#xff0c;\u4e8b\u4ef6\u59d4\u6258\u7684\u5199\u6cd5\u4e5f\u80fd\u5de5\u4f5c\u3002<\/p>\n<p>\u8fd9\u7bc7\u6587\u7ae0\u53ea\u8bb2\u4e00\u4ef6\u4e8b&#xff1a;\u6846\u67b6 A \u7684\u8fd0\u884c\u65f6\u662f\u600e\u4e48\u5728\u65e0 DOM \u7684\u73af\u5883\u91cc&#xff0c;\u628a DOM \u4e8b\u4ef6\u8bed\u4e49\u4e00\u5c42\u5c42\u300c\u9a97\u300d\u51fa\u6765\u7684\u3002\u5168\u6587\u56f4\u7ed5\u56db\u4e2a\u95ee\u9898\u5c55\u5f00&#xff1a;<\/p>\n<li>\u539f\u751f\u4e8b\u4ef6\u8fdb\u6765&#xff0c;\u6846\u67b6\u5728\u54ea\u63a5\u4f4f\u5b83&#xff1f;&#xff08;\u4e8b\u4ef6\u4e2d\u5fc3\u4e0e\u94a9\u5b50\u6ce8\u5165&#xff09;<\/li>\n<li>e.target \/ e.currentTarget \u5230\u5e95\u662f\u4ec0\u4e48&#xff1f;&#xff08;\u5408\u6210\u4e8b\u4ef6\u5bf9\u8c61\u7684\u60f0\u6027\u6c42\u503c&#xff09;<\/li>\n<li>\u4e8b\u4ef6\u600e\u4e48\u627e\u5230\u300c\u88ab\u70b9\u7684\u662f\u865a\u62df\u6811\u4e0a\u54ea\u4e2a\u8282\u70b9\u300d&#xff1f;&#xff08;sid \u53cd\u67e5&#xff09;<\/li>\n<li>\u6355\u83b7-\u5192\u6ce1-\u59d4\u6258\u8bed\u4e49\u600e\u4e48\u6a21\u62df\u51fa\u6765&#xff1f;&#xff08;\u4e8b\u4ef6\u94fe\u8def\u91cd\u5efa&#xff09;<\/li>\n<p>\u4ee5\u53ca\u6700\u540e\u548c\u539f\u751f\u7ec4\u4ef6\u5e93 B \u7684\u5bf9\u7167&#xff1a;\u540c\u4e00\u4e2a\u300c\u4ea4\u4e92\u6027\u80fd\u300d\u95ee\u9898&#xff0c;\u4e24\u6761\u8def\u7ebf\u7ed9\u51fa\u4e86\u622a\u7136\u76f8\u53cd\u7684\u7b54\u6848\u3002<\/p>\n<hr \/>\n<h3>\u4e00\u3001\u4e8b\u4ef6\u4e2d\u5fc3&#xff1a;\u65e0 DOM \u73af\u5883\u91cc\u7684\u7b2c\u4e00\u9053\u5173\u5361<\/h3>\n<h4>1.1 \u5c0f\u7a0b\u5e8f\u4e8b\u4ef6\u7684\u539f\u59cb\u5f62\u6001<\/h4>\n<p>\u5148\u5bf9\u9f50\u4e8b\u5b9e\u3002\u5c0f\u7a0b\u5e8f\u539f\u751f\u4e8b\u4ef6\u4f20\u9012\u5230\u903b\u8f91\u5c42\u65f6&#xff0c;\u957f\u4ec0\u4e48\u6837&#xff08;\u7b80\u5316&#xff09;&#xff1a;<\/p>\n<p>\u6e32\u67d3\u5c42&#xff08;\u7528\u6237\u70b9\u51fb&#xff09;<br \/>\n   \u2502  \u5e73\u53f0\u6865<br \/>\n   \u25bc<br \/>\n\u903b\u8f91\u5c42\u6536\u5230&#xff1a;<br \/>\n{<br \/>\n  type: &#039;tap&#039;,<br \/>\n  detail: { x: 120, y: 340 },<br \/>\n  target: { id: &#039;&#039;, dataset: { sid: &#039;a-3f-12&#039; } },  \/\/ \u4ec5\u539f\u6837\u5e26\u56de\u7ed1\u5b9a\u65f6\u8bbe\u7f6e\u7684 dataset<br \/>\n  currentTarget: { dataset: { sid: &#039;a-3f-12&#039; } },<br \/>\n  &#8230;<br \/>\n}<\/p>\n<p>\u6ce8\u610f\u4e24\u4e2a\u81f4\u547d\u7f3a\u9677&#xff1a;<\/p>\n<ul>\n<li>\u8fd9\u4e2a target \u662f\u6e32\u67d3\u5c42\u6a21\u677f\u8282\u70b9\u7684\u4fe1\u606f&#xff0c;\u4e0d\u662f\u903b\u8f91\u5c42\u4efb\u4f55\u5bf9\u8c61\u2014\u2014\u903b\u8f91\u5c42\u6ca1\u6709\u4e00\u68f5\u6811\u53ef\u4ee5\u6307\u7740\u8bf4\u300c\u5c31\u662f\u5b83\u300d&#xff1b;<\/li>\n<li>\u5b83\u4e0d\u4f1a\u5192\u6ce1\u5230\u6846\u67b6\u5c42\u3002\u539f\u751f\u7ed1\u5b9a\u54ea\u4e2a\u8282\u70b9&#xff0c;\u56de\u8c03\u5c31\u6302\u5728\u54ea\u4e2a\u8282\u70b9\u4e0a&#xff0c;\u9010\u7ea7\u5411\u4e0a\u4f20\u9012\u7ed1\u5b9a\u7684\u8bed\u4e49\u9700\u8981\u6846\u67b6\u81ea\u5df1\u7ec4\u7ec7\u3002<\/li>\n<\/ul>\n<p>\u6240\u4ee5\u8de8\u7aef\u6846\u67b6\u5fc5\u987b\u5728\u903b\u8f91\u5c42\u91cd\u5efa\u4e00\u4e2a\u300c\u63a5\u4e8b\u4ef6\u7684\u5165\u53e3\u300d\u3002\u6846\u67b6 A \u7684\u505a\u6cd5\u662f&#xff1a;\u8fd0\u884c\u65f6\u91cc\u6709\u4e00\u4e2a\u4e8b\u4ef6\u4e2d\u5fc3&#xff0c;\u6240\u6709\u5e73\u53f0\u539f\u751f\u4e8b\u4ef6\u5148\u6253\u5230\u4e8b\u4ef6\u4e2d\u5fc3&#xff0c;\u518d\u7531\u5b83\u7edf\u4e00\u5206\u53d1\u7ed9\u6846\u67b6\u5c42\u3002<\/p>\n<p>\u5e73\u53f0\u539f\u751f\u4e8b\u4ef6&#xff08;tap\/touchmove\/&#8230;&#xff09;<br \/>\n        \u2502<br \/>\n        \u25bc<br \/>\n\u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510<br \/>\n\u2502  \u4e8b\u4ef6\u4e2d\u5fc3&#xff08;\u8fd0\u884c\u65f6\u7684\u53ef\u66ff\u6362\u7ec4\u4ef6&#xff09;  \u2502<br \/>\n\u2502  &#8211; \u6536\u4e8b\u4ef6                     \u2502<br \/>\n\u2502  &#8211; \u67e5\u8282\u70b9\u7f13\u5b58                  \u2502<br \/>\n\u2502  &#8211; \u6784\u9020\u5408\u6210\u4e8b\u4ef6\u5bf9\u8c61             \u2502<br \/>\n\u2502  &#8211; \u6a21\u62df\u6355\u83b7\u2192\u5192\u6ce1               \u2502<br \/>\n\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518<br \/>\n        \u2502<br \/>\n        \u25bc<br \/>\n  \u6846\u67b6\u5c42&#xff08;React\/Vue \u7684\u5408\u6210\u4e8b\u4ef6\u5904\u7406&#xff09;<\/p>\n<h4>1.2 \u4e8b\u4ef6\u4e2d\u5fc3\u672c\u8eab\u662f\u4e2a\u94a9\u5b50\u6ce8\u5165\u70b9<\/h4>\n<p>\u8fd9\u91cc\u6709\u4e00\u4e2a\u5bb9\u6613\u88ab\u5ffd\u7565\u3001\u4f46\u67b6\u6784\u4e0a\u975e\u5e38\u91cd\u8981\u7684\u7ec6\u8282&#xff1a;\u4e8b\u4ef6\u4e2d\u5fc3\u4e0d\u662f\u8fd0\u884c\u65f6\u786c\u7f16\u7801\u7684&#xff0c;\u5b83\u672c\u8eab\u5c31\u662f\u4e00\u4e2a\u53ef\u66ff\u6362\u7684\u94a9\u5b50\u70b9\u3002<\/p>\n<p>\u6846\u67b6 A \u7684\u8fd0\u884c\u65f6\u6838\u5fc3\u4ee3\u7801\u91cc\u627e\u4e0d\u5230\u4efb\u4f55\u300c\u5177\u4f53 UI \u6846\u67b6\u300d\u7684 import\u2014\u2014\u6ca1\u6709 React&#xff0c;\u6ca1\u6709 Vue\u3002\u8fd0\u884c\u65f6\u5b9a\u4e49\u4e86\u4e00\u7ec4\u751f\u547d\u5468\u671f\u94a9\u5b50&#xff0c;\u5176\u4e2d\u5c31\u5305\u62ec\u4e8b\u4ef6\u7cfb\u7edf\u7684\u5b9e\u73b0\u5165\u53e3\u3002\u5404 UI \u6846\u67b6\u7684\u6865\u63a5\u5305\u5728\u521d\u59cb\u5316\u65f6&#xff0c;\u901a\u8fc7 hooks.call(&#8230;) \u628a\u81ea\u5df1\u7684\u4e8b\u4ef6\u5904\u7406\u5b9e\u73b0\u6ce8\u5165\u8fdb\u6765&#xff1a;<\/p>\n<p><span class=\"token comment\">\/\/ \u7b80\u5316\u4f2a\u4ee3\u7801&#xff1a;\u4e8b\u4ef6\u4e2d\u5fc3\u901a\u8fc7\u94a9\u5b50\u7cfb\u7edf\u83b7\u53d6\u5b9e\u73b0<\/span><br \/>\n<span class=\"token comment\">\/\/ \u8fd0\u884c\u65f6\u6838\u5fc3&#xff08;\u4e0d\u8ba4\u8bc6\u4efb\u4f55 UI \u6846\u67b6&#xff09;<\/span><br \/>\n<span class=\"token keyword\">class<\/span> <span class=\"token class-name\">EventCenter<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n  <span class=\"token function\">handleNativeEvent<\/span><span class=\"token punctuation\">(<\/span><span class=\"token parameter\">nativeEvent<span class=\"token punctuation\">,<\/span> page<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token comment\">\/\/ \u901a\u8fc7\u94a9\u5b50\u62ff\u5230\u300c\u7531 UI \u6846\u67b6\u6865\u63a5\u5305\u6ce8\u5165\u300d\u7684\u4e8b\u4ef6\u5904\u7406\u5b9e\u73b0<\/span><br \/>\n    <span class=\"token keyword\">const<\/span> dispatch <span class=\"token operator\">&#061;<\/span> <span class=\"token function\">hooks<\/span><span class=\"token punctuation\">.<\/span><span class=\"token function\">call<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#039;onEvent&#039;<\/span><span class=\"token punctuation\">,<\/span> nativeEvent<span class=\"token punctuation\">,<\/span> page<span class=\"token punctuation\">)<\/span><br \/>\n    <span class=\"token keyword\">return<\/span> dispatch<br \/>\n  <span class=\"token punctuation\">}<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p><span class=\"token comment\">\/\/ \u7b80\u5316\u4f2a\u4ee3\u7801&#xff1a;UI \u6846\u67b6\u6865\u63a5\u5305\u6ce8\u5165\u5b9e\u73b0<\/span><br \/>\n<span class=\"token comment\">\/\/ \u67d0\u4e2a UI \u6846\u67b6\u7684\u6865\u63a5\u5305\u521d\u59cb\u5316\u65f6<\/span><br \/>\nhooks<span class=\"token punctuation\">.<\/span><span class=\"token function\">tap<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#039;onEvent&#039;<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token punctuation\">(<\/span><span class=\"token parameter\">nativeEvent<span class=\"token punctuation\">,<\/span> page<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token operator\">&#061;&gt;<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n  <span class=\"token comment\">\/\/ \u6846\u67b6\u81ea\u5df1\u7684\u5408\u6210\u4e8b\u4ef6\u6784\u9020 &#043; \u5206\u53d1\u903b\u8f91<\/span><br \/>\n  <span class=\"token keyword\">const<\/span> syntheticEvent <span class=\"token operator\">&#061;<\/span> <span class=\"token function\">buildSyntheticEvent<\/span><span class=\"token punctuation\">(<\/span>nativeEvent<span class=\"token punctuation\">)<\/span><br \/>\n  <span class=\"token keyword\">return<\/span> <span class=\"token function\">dispatchThroughBubbles<\/span><span class=\"token punctuation\">(<\/span>syntheticEvent<span class=\"token punctuation\">)<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">)<\/span><\/p>\n<p>\u8fd9\u6837\u8bbe\u8ba1\u7684\u6536\u76ca\u662f&#xff1a;\u8fd0\u884c\u65f6\u96f6\u4f9d\u8d56\u5177\u4f53\u6846\u67b6\u3002 React \u6865\u63a5\u5305\u6ce8\u5165 React \u7684\u4e8b\u4ef6\u8bed\u4e49&#xff08;\u6bd4\u5982\u5408\u6210\u4e8b\u4ef6\u6c60\u3001onXxx \u547d\u540d\u6620\u5c04&#xff09;&#xff0c;Vue \u6865\u63a5\u5305\u6ce8\u5165 Vue \u7684\u8bed\u4e49\u3002\u4e8b\u4ef6\u7cfb\u7edf\u8fd9\u79cd\u300c\u6bcf\u4e2a\u6846\u67b6\u884c\u4e3a\u90fd\u7565\u6709\u5dee\u5f02\u300d\u7684\u5730\u65b9&#xff0c;\u6070\u6070\u662f\u6700\u9700\u8981\u53ef\u66ff\u6362\u7684\u2014\u2014\u5982\u679c\u5199\u6b7b\u5728\u8fd0\u884c\u65f6\u91cc&#xff0c;\u6bcf\u63a5\u4e00\u4e2a\u65b0\u6846\u67b6\u5c31\u8981\u6539\u5185\u6838&#xff0c;\u63d2\u4ef6\u5f0f\u67b6\u6784\u5c31\u540d\u5b58\u5b9e\u4ea1\u4e86\u3002<\/p>\n<p>\u4e00\u53e5\u8bdd\u603b\u7ed3\u8fd9\u4e00\u5c42\u7684\u5206\u5de5&#xff1a;<\/p>\n<ul>\n<li>\u8fd0\u884c\u65f6\u63d0\u4f9b\u300c\u63a5\u4e8b\u4ef6 &#043; \u53cd\u67e5\u8282\u70b9 &#043; \u6784\u9020\u901a\u7528\u5408\u6210\u4e8b\u4ef6\u300d\u7684\u5e95\u5ea7&#xff1b;<\/li>\n<li>UI \u6846\u67b6\u6865\u63a5\u5305\u51b3\u5b9a\u300c\u62ff\u5230\u5408\u6210\u4e8b\u4ef6\u540e\u600e\u4e48\u5206\u53d1\u3001\u600e\u4e48\u6620\u5c04\u5230\u7ec4\u4ef6\u6811\u56de\u8c03\u300d\u3002<\/li>\n<\/ul>\n<h4>1.3 \u9762\u8bd5\u8bdd\u672f\u5c0f\u7ed3<\/h4>\n<p>\u4e00\u53e5\u8bdd\u7248&#xff1a;<br \/>\n\u201c\u5c0f\u7a0b\u5e8f\u903b\u8f91\u5c42\u6ca1\u6709 DOM&#xff0c;\u4e8b\u4ef6\u53ea\u662f JSON \u5316\u7684\u5bf9\u8c61\u3002\u6846\u67b6 A \u5728\u8fd0\u884c\u65f6\u5efa\u4e86\u4e00\u4e2a\u4e8b\u4ef6\u4e2d\u5fc3\u4f5c\u4e3a\u6240\u6709\u539f\u751f\u4e8b\u4ef6\u7684\u7edf\u4e00\u5165\u53e3&#xff0c;\u4e8b\u4ef6\u4e2d\u5fc3\u672c\u8eab\u901a\u8fc7\u94a9\u5b50\u7cfb\u7edf\u6ce8\u5165\u5b9e\u73b0&#xff0c;\u7531\u5404 UI \u6846\u67b6\u7684\u6865\u63a5\u5305\u66ff\u6362&#xff0c;\u8fd0\u884c\u65f6\u6838\u5fc3\u96f6\u4f9d\u8d56\u5177\u4f53\u6846\u67b6\u3002\u201d<\/p>\n<p>\u6df1\u5165\u7248&#xff1a;<br \/>\n\u201c\u539f\u751f\u4e8b\u4ef6\u7684 target \u53ea\u662f\u6e32\u67d3\u5c42\u6a21\u677f\u8282\u70b9\u7684 dataset \u5feb\u7167&#xff0c;\u903b\u8f91\u5c42\u6ca1\u6709\u4efb\u4f55\u6811\u7ed3\u6784\u53ef\u4ee5\u5bf9\u5e94\u3002\u6846\u67b6\u7684\u505a\u6cd5\u662f\u628a\u4e8b\u4ef6\u4e2d\u5fc3\u8bbe\u8ba1\u6210\u94a9\u5b50\u6ce8\u5165\u70b9&#xff1a;\u8fd0\u884c\u65f6\u901a\u8fc7 hooks.call \u62ff\u5230\u7531\u6865\u63a5\u5305\u6ce8\u518c\u7684\u4e8b\u4ef6\u5206\u53d1\u5b9e\u73b0&#xff0c;React\/Vue \u5404\u81ea\u6ce8\u5165\u81ea\u5df1\u7684\u4e8b\u4ef6\u8bed\u4e49\u3002\u8fd9\u6837\u4e8b\u4ef6\u7cfb\u7edf\u8fd9\u7c7b\u6846\u67b6\u95f4\u884c\u4e3a\u5dee\u5f02\u6700\u5927\u7684\u6a21\u5757\u5929\u7136\u53ef\u66ff\u6362&#xff0c;\u662f\u8fd0\u884c\u65f6\u4e0d\u7ed1\u5b9a UI \u6846\u67b6\u7684\u5173\u952e\u8bbe\u8ba1\u3002\u201d<\/p>\n<hr \/>\n<h3>\u4e8c\u3001\u5408\u6210\u4e8b\u4ef6\u5bf9\u8c61&#xff1a;target\/currentTarget \u662f\u300c\u7b97\u51fa\u6765\u300d\u7684<\/h3>\n<h4>2.1 \u4e0d\u662f\u5b57\u6bb5&#xff0c;\u662f getter<\/h4>\n<p>\u63a5\u4f4f\u4e8b\u4ef6\u4e4b\u540e&#xff0c;\u7b2c\u4e00\u4ef6\u4e8b\u662f\u628a\u539f\u751f JSON \u5305\u88c5\u6210 React\/Vue \u5f00\u53d1\u8005\u719f\u6089\u7684\u5408\u6210\u4e8b\u4ef6\u5bf9\u8c61\u3002\u6846\u67b6 A \u5b9e\u73b0\u91cc\u6709\u4e2a\u975e\u5e38\u503c\u5f97\u7ec6\u770b\u7684\u8bbe\u8ba1&#xff1a;target \u548c currentTarget \u4e0d\u662f\u7b80\u5355\u7684\u5bf9\u8c61\u5b57\u6bb5&#xff0c;\u800c\u662f\u7528 getter \u505a\u60f0\u6027\u6c42\u503c\u2014\u2014\u8bbf\u95ee\u65f6\u624d\u8ba1\u7b97&#xff0c;\u8ba1\u7b97\u8fc7\u5c31\u7f13\u5b58\u3002<\/p>\n<p><span class=\"token comment\">\/\/ \u7b80\u5316\u4f2a\u4ee3\u7801&#xff1a;\u5408\u6210\u4e8b\u4ef6\u5bf9\u8c61\u7684\u60f0\u6027\u6c42\u503c<\/span><br \/>\n<span class=\"token keyword\">class<\/span> <span class=\"token class-name\">SyntheticEvent<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n  <span class=\"token function\">constructor<\/span><span class=\"token punctuation\">(<\/span><span class=\"token parameter\">nativeEvent<span class=\"token punctuation\">,<\/span> eventPath<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token keyword\">this<\/span><span class=\"token punctuation\">.<\/span>type <span class=\"token operator\">&#061;<\/span> nativeEvent<span class=\"token punctuation\">.<\/span>type<br \/>\n    <span class=\"token keyword\">this<\/span><span class=\"token punctuation\">.<\/span>detail <span class=\"token operator\">&#061;<\/span> nativeEvent<span class=\"token punctuation\">.<\/span>detail<br \/>\n    <span class=\"token keyword\">this<\/span><span class=\"token punctuation\">.<\/span>_eventPath <span class=\"token operator\">&#061;<\/span> eventPath   <span class=\"token comment\">\/\/ \u540e\u6587\u8bb2\u5230\u7684\u5192\u6ce1\u8def\u5f84&#xff08;\u8282\u70b9\u5217\u8868&#xff09;<\/span><br \/>\n    <span class=\"token keyword\">this<\/span><span class=\"token punctuation\">.<\/span>_targetCache <span class=\"token operator\">&#061;<\/span> <span class=\"token keyword\">null<\/span><br \/>\n    <span class=\"token keyword\">this<\/span><span class=\"token punctuation\">.<\/span>_currentTargetCache <span class=\"token operator\">&#061;<\/span> <span class=\"token keyword\">null<\/span><br \/>\n  <span class=\"token punctuation\">}<\/span><\/p>\n<p>  <span class=\"token keyword\">get<\/span> <span class=\"token function\">target<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token comment\">\/\/ \u4e0d\u8bbf\u95ee\u5c31\u4e0d\u8ba1\u7b97&#xff1b;\u8bbf\u95ee\u65f6\u628a\u6e32\u67d3\u5c42\u8282\u70b9\u4fe1\u606f<\/span><br \/>\n    <span class=\"token comment\">\/\/ \u7ffb\u8bd1\u6210\u865a\u62df\u6811\u4e0a\u771f\u5b9e\u7684\u6846\u67b6\u8282\u70b9<\/span><br \/>\n    <span class=\"token keyword\">if<\/span> <span class=\"token punctuation\">(<\/span><span class=\"token keyword\">this<\/span><span class=\"token punctuation\">.<\/span>_targetCache <span class=\"token operator\">&#061;&#061;&#061;<\/span> <span class=\"token keyword\">null<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n      <span class=\"token keyword\">this<\/span><span class=\"token punctuation\">.<\/span>_targetCache <span class=\"token operator\">&#061;<\/span> <span class=\"token function\">resolveNode<\/span><span class=\"token punctuation\">(<\/span><span class=\"token keyword\">this<\/span><span class=\"token punctuation\">.<\/span>_eventPath<span class=\"token punctuation\">[<\/span><span class=\"token number\">0<\/span><span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">)<\/span><br \/>\n    <span class=\"token punctuation\">}<\/span><br \/>\n    <span class=\"token keyword\">return<\/span> <span class=\"token keyword\">this<\/span><span class=\"token punctuation\">.<\/span>_targetCache<br \/>\n  <span class=\"token punctuation\">}<\/span><\/p>\n<p>  <span class=\"token keyword\">get<\/span> <span class=\"token function\">currentTarget<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token comment\">\/\/ \u5192\u6ce1\u8def\u5f84\u4e0a\u300c\u5f53\u524d\u6b63\u5728\u6267\u884c\u56de\u8c03\u300d\u7684\u90a3\u4e2a\u8282\u70b9<\/span><br \/>\n    <span class=\"token keyword\">if<\/span> <span class=\"token punctuation\">(<\/span><span class=\"token keyword\">this<\/span><span class=\"token punctuation\">.<\/span>_currentTargetCache <span class=\"token operator\">&#061;&#061;&#061;<\/span> <span class=\"token keyword\">null<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n      <span class=\"token keyword\">this<\/span><span class=\"token punctuation\">.<\/span>_currentTargetCache <span class=\"token operator\">&#061;<\/span> <span class=\"token function\">resolveNode<\/span><span class=\"token punctuation\">(<\/span><span class=\"token keyword\">this<\/span><span class=\"token punctuation\">.<\/span>_eventPath<span class=\"token punctuation\">[<\/span><span class=\"token keyword\">this<\/span><span class=\"token punctuation\">.<\/span>_currentIndex<span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">)<\/span><br \/>\n    <span class=\"token punctuation\">}<\/span><br \/>\n    <span class=\"token keyword\">return<\/span> <span class=\"token keyword\">this<\/span><span class=\"token punctuation\">.<\/span>_currentTargetCache<br \/>\n  <span class=\"token punctuation\">}<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p>\u4e3a\u4ec0\u4e48\u8fd9\u4e48\u8bbe\u8ba1&#xff1f;\u4e24\u4e2a\u52a8\u673a&#xff1a;<\/p>\n<p>&#xff08;1&#xff09;\u53cd\u67e5\u662f\u6709\u6210\u672c\u7684&#xff0c;\u6ca1\u5fc5\u8981\u6bcf\u4e2a\u4e8b\u4ef6\u90fd\u505a\u3002 target \u7684\u8ba1\u7b97\u4f9d\u8d56\u300c\u6e32\u67d3\u5c42\u6807\u8bc6 \u2192 \u865a\u62df\u6811\u8282\u70b9\u300d\u7684\u53cd\u67e5&#xff08;\u4e0b\u4e00\u8282\u5c55\u5f00&#xff09;\u3002\u5f88\u591a\u4e8b\u4ef6\u5904\u7406\u51fd\u6570\u6839\u672c\u4e0d\u8bfb e.target\u2014\u2014\u53ea\u8c03\u7528\u4e00\u4e0b setState \u5c31\u5b8c\u4e86\u3002\u60f0\u6027\u6c42\u503c\u610f\u5473\u7740&#xff1a;\u4e0d\u8bbf\u95ee target&#xff0c;\u4e00\u6b21\u53cd\u67e5\u90fd\u4e0d\u4f1a\u53d1\u751f\u3002 \u9ad8\u9891\u4e8b\u4ef6&#xff08;touchmove\u3001\u6eda\u52a8&#xff09;\u4e0b&#xff0c;\u8fd9\u4e2a\u7701\u7565\u662f\u5b9e\u6253\u5b9e\u7684\u6027\u80fd\u6536\u76ca\u3002<\/p>\n<p>&#xff08;2&#xff09;\u7f13\u5b58\u4fdd\u8bc1\u8bed\u4e49\u4e00\u81f4\u3002 \u540c\u4e00\u4e2a\u4e8b\u4ef6\u5bf9\u8c61\u5728\u5192\u6ce1\u8fc7\u7a0b\u4e2d\u4f1a\u7ecf\u8fc7\u591a\u4e2a\u56de\u8c03\u3002\u7b2c\u4e00\u4e2a\u56de\u8c03\u8bfb\u4e86 e.target \u89e6\u53d1\u8ba1\u7b97\u5e76\u7f13\u5b58&#xff0c;\u540e\u7eed\u56de\u8c03\u62ff\u5230\u7684\u6c38\u8fdc\u662f\u540c\u4e00\u4e2a\u8282\u70b9\u5f15\u7528\u2014\u2014\u548c DOM \u4e8b\u4ef6\u300ctarget \u5728\u6574\u4e2a\u4f20\u64ad\u8fc7\u7a0b\u4e2d\u4e0d\u53d8\u300d\u7684\u8bed\u4e49\u5b8c\u5168\u5bf9\u9f50\u3002<\/p>\n<h4>2.2 currentTarget \u662f\u300c\u968f\u4f20\u64ad\u6d41\u52a8\u300d\u7684<\/h4>\n<p>\u5bf9\u7167\u4e00\u4e0b DOM \u8bed\u4e49&#xff0c;\u8fd9\u4e24\u8005\u7684\u533a\u522b\u662f&#xff1a;<\/p>\n<ul>\n<li>target&#xff1a;\u89e6\u53d1\u4e8b\u4ef6\u7684\u539f\u59cb\u8282\u70b9&#xff0c;\u6574\u4e2a\u4f20\u64ad\u8fc7\u7a0b\u4e2d\u4e0d\u53d8&#xff1b;<\/li>\n<li>currentTarget&#xff1a;\u5f53\u524d\u6b63\u5728\u6267\u884c\u56de\u8c03\u7684\u90a3\u4e2a\u8282\u70b9&#xff0c;\u5192\u6ce1\u5230\u7236\u7ea7\u65f6&#xff0c;\u7236\u7ea7\u56de\u8c03\u91cc\u8bfb\u5230\u7684 currentTarget \u662f\u7236\u8282\u70b9\u3002<\/li>\n<\/ul>\n<p>\u5728\u6d4f\u89c8\u5668\u91cc\u8fd9\u4e24\u4e2a\u503c\u7531\u5185\u6838\u7ef4\u62a4&#xff1b;\u5728\u6846\u67b6 A \u91cc&#xff0c;target \u53d6\u5192\u6ce1\u8def\u5f84\u7684\u7b2c 0 \u4e2a\u8282\u70b9&#xff0c;currentTarget \u53d6\u8def\u5f84\u4e0a\u300c\u5f53\u524d\u6267\u884c\u6307\u9488\u300d\u6307\u5411\u7684\u8282\u70b9\u3002\u5192\u6ce1\u5faa\u73af\u6bcf\u524d\u8fdb\u4e00\u5c42&#xff0c;\u6307\u9488\u53f3\u79fb\u4e00\u4f4d\u2014\u2014\u4e8e\u662f\u5f00\u53d1\u8005\u5199 e.currentTarget.dataset \u65f6&#xff0c;\u62ff\u5230\u7684\u6b63\u662f\u300c\u7ed1\u5b9a\u8fd9\u4e2a\u56de\u8c03\u7684\u8282\u70b9\u300d\u7684 dataset&#xff0c;\u548c\u6d4f\u89c8\u5668\u884c\u4e3a\u4e00\u81f4\u3002<\/p>\n<p>\u5192\u6ce1\u8def\u5f84&#xff08;\u6355\u83b7\u540e\u4ece\u6700\u6df1\u5904\u5411\u4e0a&#xff09;&#xff1a;<br \/>\n [view-item] \u2192 [view-list] \u2192 [view-page]<br \/>\n     \u25b2 target \u56fa\u5b9a\u5728\u8fd9\u91cc<\/p>\n<p>\u4e8b\u4ef6\u4f20\u64ad\u8fc7\u7a0b\u4e2d currentIndex \u53d8\u5316&#xff1a;<br \/>\n  \u56de\u8c03\u6267\u884c\u5728 view-item   \u2192 currentTarget &#061; view-item<br \/>\n  \u56de\u8c03\u6267\u884c\u5728 view-list   \u2192 currentTarget &#061; view-list<\/p>\n<h4>2.3 stopPropagation&#xff1a;\u4e00\u4e2a\u6807\u5fd7\u4f4d\u7684\u4e8b<\/h4>\n<p>\u6709\u4e86\u5192\u6ce1\u5faa\u73af&#xff0c;stopPropagation() \u7684\u5b9e\u73b0\u53cd\u800c\u6700\u7b80\u5355\u2014\u2014\u5b83\u5c31\u662f\u5728\u5408\u6210\u4e8b\u4ef6\u5bf9\u8c61\u4e0a\u6253\u4e00\u4e2a\u6807\u5fd7\u4f4d&#xff0c;\u5192\u6ce1\u5faa\u73af\u6bcf\u6267\u884c\u5b8c\u4e00\u5c42\u56de\u8c03\u5c31\u68c0\u67e5\u5b83&#xff1a;<\/p>\n<p><span class=\"token comment\">\/\/ \u7b80\u5316\u4f2a\u4ee3\u7801&#xff1a;\u5192\u6ce1\u5faa\u73af&#xff08;\u7b80\u5316\u7248&#xff0c;\u5b8c\u6574\u7248\u89c1\u7b2c\u56db\u8282&#xff09;<\/span><br \/>\n<span class=\"token keyword\">for<\/span> <span class=\"token punctuation\">(<\/span><span class=\"token keyword\">let<\/span> i <span class=\"token operator\">&#061;<\/span> path<span class=\"token punctuation\">.<\/span>length <span class=\"token operator\">&#8211;<\/span> <span class=\"token number\">1<\/span><span class=\"token punctuation\">;<\/span> i <span class=\"token operator\">&gt;&#061;<\/span> <span class=\"token number\">0<\/span><span class=\"token punctuation\">;<\/span> i<span class=\"token operator\">&#8212;<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n  <span class=\"token keyword\">if<\/span> <span class=\"token punctuation\">(<\/span>event<span class=\"token punctuation\">.<\/span>_stopped<span class=\"token punctuation\">)<\/span> <span class=\"token keyword\">break<\/span>     <span class=\"token comment\">\/\/ \u2190 stopPropagation \u7684\u751f\u6548\u70b9<\/span><br \/>\n  event<span class=\"token punctuation\">.<\/span>_currentIndex <span class=\"token operator\">&#061;<\/span> i       <span class=\"token comment\">\/\/ currentTarget \u6307\u9488\u53f3\u79fb<\/span><br \/>\n  <span class=\"token keyword\">const<\/span> node <span class=\"token operator\">&#061;<\/span> path<span class=\"token punctuation\">[<\/span>i<span class=\"token punctuation\">]<\/span><br \/>\n  <span class=\"token function\">invoke<\/span><span class=\"token punctuation\">(<\/span>node<span class=\"token punctuation\">,<\/span> event<span class=\"token punctuation\">)<\/span>           <span class=\"token comment\">\/\/ \u6267\u884c\u8be5\u8282\u70b9\u4e0a\u7ed1\u5b9a\u7684\u56de\u8c03<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p>\u56de\u5934\u770b\u5f15\u8a00\u91cc\u7684\u90a3\u6bb5\u4e1a\u52a1\u4ee3\u7801&#xff1a;e.stopPropagation() \u5728\u5220\u9664\u6309\u94ae\u7684\u56de\u8c03\u91cc\u88ab\u8c03\u7528 \u2192 \u6807\u5fd7\u4f4d\u7ffb\u8f6c \u2192 \u5192\u6ce1\u5faa\u73af\u5728\u6267\u884c\u5230\u5916\u5c42 view \u524d\u4e2d\u65ad \u2192 onSelect \u4e0d\u4f1a\u6267\u884c\u3002\u6574\u6761\u94fe\u8def\u91cc\u6ca1\u6709\u4e00\u884c\u5e73\u53f0\u4ee3\u7801\u53c2\u4e0e&#xff0c;\u5168\u90e8\u53d1\u751f\u5728\u903b\u8f91\u5c42\u7684\u6a21\u62df\u5c42\u91cc\u3002<\/p>\n<h4>2.4 \u9762\u8bd5\u8bdd\u672f\u5c0f\u7ed3<\/h4>\n<p>\u4e00\u53e5\u8bdd\u7248&#xff1a;<br \/>\n\u201c\u5408\u6210\u4e8b\u4ef6\u5bf9\u8c61\u91cc target \u548c currentTarget \u4e0d\u662f\u666e\u901a\u5b57\u6bb5&#xff0c;\u662f getter \u60f0\u6027\u6c42\u503c\u52a0\u7f13\u5b58&#xff1a;\u4e0d\u8bfb\u4e0d\u53cd\u67e5\u3001\u8bfb\u4e86\u7b97\u4e00\u6b21\u540e\u56fa\u5316\u3002target \u56fa\u5b9a\u6307\u5411\u5192\u6ce1\u8def\u5f84\u8d77\u70b9&#xff0c;currentTarget \u8ddf\u7740\u4f20\u64ad\u6307\u9488\u6d41\u52a8&#xff0c;stopPropagation \u5c31\u662f\u4e00\u4e2a\u6807\u5fd7\u4f4d\u8ba9\u5192\u6ce1\u5faa\u73af\u63d0\u524d\u9000\u51fa\u3002\u201d<\/p>\n<p>\u6df1\u5165\u7248&#xff1a;<br \/>\n\u201c\u60f0\u6027\u6c42\u503c\u7684\u52a8\u673a\u662f\u53cd\u67e5\u6709\u6210\u672c&#xff1a;touchmove \u8fd9\u7c7b\u9ad8\u9891\u4e8b\u4ef6\u591a\u6570\u56de\u8c03\u4e0d\u8bfb target&#xff0c;getter \u4fdd\u8bc1\u4e0d\u8bbf\u95ee\u5c31\u4e0d\u8ba1\u7b97\u3002\u7f13\u5b58\u8fd8\u4fdd\u8bc1\u591a\u6b21\u8bbf\u95ee\u62ff\u5230\u540c\u4e00\u8282\u70b9\u5f15\u7528&#xff0c;\u5bf9\u9f50 DOM &#039;target \u4f20\u64ad\u8fc7\u7a0b\u4e2d\u4e0d\u53d8\u2019\u7684\u8bed\u4e49\u3002currentTarget \u7684\u5b9e\u73b0\u4f9d\u8d56\u5192\u6ce1\u8def\u5f84\u4e0a\u7684\u6267\u884c\u6307\u9488\u2014\u2014\u6bcf\u524d\u8fdb\u4e00\u5c42\u6307\u9488\u53f3\u79fb&#xff0c;getter \u8bfb\u6307\u9488\u4f4d\u7f6e\u53cd\u67e5\u8282\u70b9\u3002stopPropagation \u4e0d\u9700\u8981\u5e73\u53f0\u4efb\u4f55\u914d\u5408&#xff0c;\u5192\u6ce1\u5faa\u73af\u6bcf\u5c42\u68c0\u67e5\u6807\u5fd7\u4f4d\u5373\u53ef&#xff0c;\u6574\u4e2a\u8bed\u4e49\u5b8c\u5168\u5728\u903b\u8f91\u5c42\u6a21\u62df\u51fa\u6765\u3002\u201d<\/p>\n<hr \/>\n<h3>\u4e09\u3001sid \u53cd\u67e5&#xff1a;\u4e8b\u4ef6\u600e\u4e48\u627e\u56de\u865a\u62df\u6811\u4e0a\u7684\u8282\u70b9<\/h3>\n<h4>3.1 \u95ee\u9898&#xff1a;\u903b\u8f91\u5c42\u6536\u5230\u7684\u662f\u300c\u6807\u8bc6\u300d&#xff0c;\u4e0d\u662f\u300c\u8282\u70b9\u300d<\/h4>\n<p>\u73b0\u5728\u5230\u4e86\u6574\u5957\u673a\u5236\u6700\u6838\u5fc3\u7684\u96be\u9898\u3002\u5192\u6ce1\u8def\u5f84\u3001target\u3001currentTarget&#xff0c;\u5168\u90fd\u6307\u5411\u4e00\u4e2a\u524d\u63d0&#xff1a;\u903b\u8f91\u5c42\u8981\u6709\u4e00\u68f5\u6811&#xff0c;\u4e14\u4e8b\u4ef6\u80fd\u5b9a\u4f4d\u5230\u6811\u4e0a\u7684\u8282\u70b9\u3002<\/p>\n<p>\u53ef\u539f\u751f\u4e8b\u4ef6\u5e26\u6765\u7684\u53ea\u6709 JSON\u3002\u6e32\u67d3\u5c42\u77e5\u9053\u4f60\u70b9\u4e86\u54ea\u4e2a\u6a21\u677f\u8282\u70b9&#xff0c;\u4f46\u5b83\u6ca1\u529e\u6cd5\u628a\u300c\u8282\u70b9\u300d\u4f20\u8fc7\u53cc\u7ebf\u7a0b\u2014\u2014\u7ebf\u7a0b\u4e4b\u95f4\u53ea\u4f20\u53ef\u5e8f\u5217\u5316\u6570\u636e\u3002<\/p>\n<p>\u6846\u67b6 A \u7684\u89e3\u6cd5\u662f\u7ecf\u5178\u7684\u6807\u8bc6\u53cd\u67e5&#xff0c;\u5206\u4e24\u6b65&#xff1a;<\/p>\n<p>\u7b2c\u4e00\u6b65&#xff1a;\u7ed1\u5b9a\u53d1\u751f\u65f6&#xff0c;\u628a\u6807\u8bc6\u5199\u5230\u8282\u70b9\u4e0a\u3002 \u4e8b\u4ef6\u7ed1\u5b9a\u7684\u672c\u8d28\u662f\u300c\u5728\u67d0\u4e2a\u865a\u62df\u8282\u70b9\u4e0a\u6302\u4e00\u4e2a\u56de\u8c03\u300d\u3002\u6846\u67b6\u5728\u5efa\u7acb\u7ed1\u5b9a\u65f6&#xff0c;\u7ed9\u6bcf\u4e2a\u7ed1\u5b9a\u4e86\u4e8b\u4ef6\u7684\u8282\u70b9\u751f\u6210\u4e00\u4e2a\u7a33\u5b9a\u6807\u8bc6&#xff08;\u4e0b\u6587\u7edf\u79f0 sid&#xff09;&#xff0c;\u5e76\u5728\u628a\u865a\u62df\u6811\u5e8f\u5217\u5316\u4e3a\u6e32\u67d3\u6570\u636e\u65f6&#xff0c;\u628a sid \u585e\u8fdb\u5bf9\u5e94\u6e32\u67d3\u8282\u70b9\u7684 dataset&#xff1a;<\/p>\n<p><span class=\"token comment\">\/\/ \u7b80\u5316\u4f2a\u4ee3\u7801&#xff1a;\u7ed1\u5b9a\u4e8b\u4ef6\u65f6\u767b\u8bb0\u6807\u8bc6<\/span><br \/>\n<span class=\"token keyword\">function<\/span> <span class=\"token function\">bindEvent<\/span><span class=\"token punctuation\">(<\/span><span class=\"token parameter\">node<span class=\"token punctuation\">,<\/span> eventType<span class=\"token punctuation\">,<\/span> handler<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n  node<span class=\"token punctuation\">.<\/span>_sid <span class=\"token operator\">&#061;<\/span> node<span class=\"token punctuation\">.<\/span>_sid <span class=\"token operator\">||<\/span> <span class=\"token function\">genId<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span>          <span class=\"token comment\">\/\/ \u8282\u70b9\u9996\u6b21\u7ed1\u5b9a\u4e8b\u4ef6\u65f6\u5206\u914d sid<\/span><br \/>\n  node<span class=\"token punctuation\">.<\/span>_handlers<span class=\"token punctuation\">[<\/span>eventType<span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">.<\/span><span class=\"token function\">push<\/span><span class=\"token punctuation\">(<\/span>handler<span class=\"token punctuation\">)<\/span><br \/>\n  <span class=\"token comment\">\/\/ \u540c\u65f6\u5728\u8282\u70b9\u7f13\u5b58\u8868\u91cc\u767b\u8bb0&#xff1a;sid \u2192 \u865a\u62df\u8282\u70b9<\/span><br \/>\n  nodeCache<span class=\"token punctuation\">.<\/span><span class=\"token function\">set<\/span><span class=\"token punctuation\">(<\/span>node<span class=\"token punctuation\">.<\/span>_sid<span class=\"token punctuation\">,<\/span> node<span class=\"token punctuation\">)<\/span><br \/>\n  <span class=\"token keyword\">return<\/span> node<span class=\"token punctuation\">.<\/span>_sid<br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p><span class=\"token comment\">\/\/ \u865a\u62df\u6811 \u2192 \u6e32\u67d3\u6570\u636e\u65f6&#xff0c;sid \u968f dataset \u4e0b\u53d1<\/span><br \/>\n<span class=\"token keyword\">function<\/span> <span class=\"token function\">serialize<\/span><span class=\"token punctuation\">(<\/span><span class=\"token parameter\">node<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n  <span class=\"token keyword\">return<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token literal-property property\">tag<\/span><span class=\"token operator\">:<\/span> node<span class=\"token punctuation\">.<\/span>tag<span class=\"token punctuation\">,<\/span><br \/>\n    <span class=\"token literal-property property\">dataset<\/span><span class=\"token operator\">:<\/span> <span class=\"token punctuation\">{<\/span> <span class=\"token literal-property property\">sid<\/span><span class=\"token operator\">:<\/span> node<span class=\"token punctuation\">.<\/span>_sid <span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">,<\/span>   <span class=\"token comment\">\/\/ \u2190 \u6e32\u67d3\u5c42\u6a21\u677f\u4e0a\u4f1a\u5e26\u8fd9\u4e2a\u503c<\/span><br \/>\n    <span class=\"token literal-property property\">children<\/span><span class=\"token operator\">:<\/span> node<span class=\"token punctuation\">.<\/span>children<span class=\"token punctuation\">.<\/span><span class=\"token function\">map<\/span><span class=\"token punctuation\">(<\/span>serialize<span class=\"token punctuation\">)<\/span><br \/>\n  <span class=\"token punctuation\">}<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p>\u7b2c\u4e8c\u6b65&#xff1a;\u4e8b\u4ef6\u89e6\u53d1\u65f6&#xff0c;\u4ece dataset \u91cc\u7684 sid \u53cd\u67e5\u56de\u8282\u70b9\u3002 \u6e32\u67d3\u5c42\u7528\u6237\u70b9\u51fb \u2192 \u539f\u751f\u4e8b\u4ef6\u5bf9\u8c61\u7684 target.dataset.sid \u539f\u6837\u5e26\u56de\u903b\u8f91\u5c42 \u2192 \u4e8b\u4ef6\u4e2d\u5fc3\u62ff\u8fd9\u4e2a sid \u53bb\u8282\u70b9\u7f13\u5b58\u8868\u91cc\u67e5&#xff0c;\u5c31\u627e\u56de\u4e86\u865a\u62df\u6811\u4e0a\u7684\u771f\u5b9e\u8282\u70b9&#xff1a;<\/p>\n<p><span class=\"token comment\">\/\/ \u7b80\u5316\u4f2a\u4ee3\u7801&#xff1a;\u4e8b\u4ef6\u89e6\u53d1\u65f6\u7684\u53cd\u67e5<\/span><br \/>\n<span class=\"token keyword\">function<\/span> <span class=\"token function\">handleNativeEvent<\/span><span class=\"token punctuation\">(<\/span><span class=\"token parameter\">nativeEvent<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n  <span class=\"token keyword\">const<\/span> sid <span class=\"token operator\">&#061;<\/span> nativeEvent<span class=\"token punctuation\">.<\/span>target<span class=\"token punctuation\">.<\/span>dataset<span class=\"token punctuation\">.<\/span>sid<br \/>\n  <span class=\"token keyword\">const<\/span> targetNode <span class=\"token operator\">&#061;<\/span> nodeCache<span class=\"token punctuation\">.<\/span><span class=\"token function\">get<\/span><span class=\"token punctuation\">(<\/span>sid<span class=\"token punctuation\">)<\/span>     <span class=\"token comment\">\/\/ \u2190 \u53cd\u67e5\u56de\u865a\u62df\u6811\u8282\u70b9<\/span><br \/>\n  <span class=\"token keyword\">if<\/span> <span class=\"token punctuation\">(<\/span><span class=\"token operator\">!<\/span>targetNode<span class=\"token punctuation\">)<\/span> <span class=\"token keyword\">return<\/span>                   <span class=\"token comment\">\/\/ \u8282\u70b9\u5df2\u5378\u8f7d\u5219\u4e22\u5f03<\/span><br \/>\n  <span class=\"token keyword\">const<\/span> eventPath <span class=\"token operator\">&#061;<\/span> <span class=\"token function\">buildBubblePath<\/span><span class=\"token punctuation\">(<\/span>targetNode<span class=\"token punctuation\">)<\/span>  <span class=\"token comment\">\/\/ \u6cbf\u7236\u94fe\u5411\u4e0a\u6784\u9020\u8def\u5f84<\/span><br \/>\n  <span class=\"token function\">dispatchSyntheticEvent<\/span><span class=\"token punctuation\">(<\/span>nativeEvent<span class=\"token punctuation\">,<\/span> eventPath<span class=\"token punctuation\">)<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261010014116-6ac997bce4d76.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n<p>\u6574\u6761\u94fe\u8def\u4e32\u8d77\u6765&#xff1a;<\/p>\n<p>\u6e32\u67d3\u5c42                     \u903b\u8f91\u5c42<br \/>\n\u2500\u2500\u2500\u2500\u2500\u2500                    \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500<br \/>\n\u7528\u6237\u70b9\u51fb\u6a21\u677f\u8282\u70b9<br \/>\n  dataset.sid &#061; a-3f-12<br \/>\n        \u2502  \u539f\u751f\u4e8b\u4ef6&#xff08;JSON&#xff09;<br \/>\n        \u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u25ba  \u4e8b\u4ef6\u4e2d\u5fc3<br \/>\n                                  1. \u53d6 target.dataset.sid<br \/>\n                                  2. nodeCache \u53cd\u67e5 \u2192 \u865a\u62df\u8282\u70b9<br \/>\n                                  3. \u6cbf\u7236\u94fe\u6784\u9020\u5192\u6ce1\u8def\u5f84<br \/>\n                                  4. \u6784\u9020\u5408\u6210\u4e8b\u4ef6\u5bf9\u8c61<br \/>\n                                  5. \u6355\u83b7\u2192\u5192\u6ce1\u5faa\u73af\u5206\u53d1<br \/>\n                                          \u2502<br \/>\n                                          \u25bc<br \/>\n                                   \u6846\u67b6\u5c42\u56de\u8c03&#xff08;React\/Vue&#xff09;<\/p>\n<h4>3.2 \u914d\u5408\u4e8b\u4ef6\u540d\u4e0e\u8282\u70b9\u7f13\u5b58&#xff0c;\u624d\u662f\u4e00\u6761\u5b8c\u6574\u94fe\u8def<\/h4>\n<p>\u5355\u70b9\u770b&#xff0c;sid \u53ea\u89e3\u51b3\u300c\u627e\u5230\u8d77\u70b9\u300d\u3002\u6e90\u7801\u91cc\u628a\u5b83\u548c\u53e6\u5916\u4e24\u4ef6\u4e8b\u914d\u5408&#xff0c;\u624d\u62fc\u51fa\u5b8c\u6574\u7684\u4e8b\u4ef6\u94fe\u8def&#xff1a;<\/p>\n<p>&#xff08;1&#xff09;\u4e8b\u4ef6\u540d\u53c2\u4e0e\u5339\u914d\u3002 \u8282\u70b9\u4e0a\u767b\u8bb0\u7684\u56de\u8c03\u6309\u4e8b\u4ef6\u7c7b\u578b\u5206\u7ec4\u2014\u2014tap \u7684\u56de\u8c03\u4e0d\u4f1a\u56e0\u4e3a touchmove \u89e6\u53d1\u3002\u5206\u53d1\u65f6&#xff0c;\u4e8b\u4ef6\u4e2d\u5fc3\u7528\u300csid &#043; \u4e8b\u4ef6\u540d\u300d\u5171\u540c\u5b9a\u4f4d\u8981\u6267\u884c\u7684\u56de\u8c03\u96c6\u5408&#xff0c;\u907f\u514d\u4e00\u4e2a\u8282\u70b9\u7ed1\u4e86\u5341\u79cd\u4e8b\u4ef6\u65f6\u7684\u904d\u5386\u5f00\u9500\u3002<\/p>\n<p>&#xff08;2&#xff09;\u8282\u70b9\u7f13\u5b58\u7684\u751f\u547d\u5468\u671f\u7ba1\u7406\u3002 nodeCache \u662f\u4e00\u5f20\u968f\u865a\u62df\u6811\u589e\u5220\u540c\u6b65\u7ef4\u62a4\u7684\u8868&#xff1a;\u8282\u70b9\u63d2\u5165\u6811\u5e76\u9996\u6b21\u7ed1\u5b9a\u65f6\u767b\u8bb0&#xff0c;\u5378\u8f7d\u65f6\u6ce8\u9500\u3002\u8fd9\u89e3\u91ca\u4e86\u4e00\u4e2a\u8fb9\u754c\u884c\u4e3a\u2014\u2014\u5982\u679c\u4e8b\u4ef6\u5728\u98de\u884c\u4e2d&#xff08;\u6e32\u67d3\u5c42\u5df2\u53d1\u51fa\u3001\u903b\u8f91\u5c42\u8fd8\u6ca1\u5904\u7406&#xff09;\u8282\u70b9\u5c31\u88ab\u5378\u8f7d&#xff0c;\u53cd\u67e5\u4f1a\u843d\u7a7a&#xff0c;\u4e8b\u4ef6\u88ab\u9759\u9ed8\u4e22\u5f03\u3002\u8fd9\u4e0d\u662f bug&#xff0c;\u800c\u662f\u300c\u6a21\u62df\u5c42\u300d\u4e0e\u771f\u5b9e DOM \u7684\u56fa\u6709\u5dee\u5f02&#xff1a;\u6d4f\u89c8\u5668\u7684\u4e8b\u4ef6\u4f20\u64ad\u662f\u5185\u6838\u540c\u6b65\u5b8c\u6210\u7684&#xff0c;\u800c\u8fd9\u91cc\u7684\u4f20\u64ad\u9694\u4e86\u4e00\u6b21\u7ebf\u7a0b\u901a\u4fe1&#xff0c;\u5feb\u7167\u53ef\u80fd\u8fc7\u671f\u3002 \u5904\u7406\u300c\u5feb\u901f\u70b9\u51fb\u5bfc\u81f4\u5217\u8868\u9879\u7acb\u5373\u5220\u9664\u300d\u8fd9\u7c7b\u573a\u666f\u65f6&#xff0c;\u8fd9\u4e2a\u7ec6\u8282\u503c\u5f97\u8bb0\u5728\u5fc3\u91cc\u3002<\/p>\n<p>&#xff08;3&#xff09;\u5192\u6ce1\u8def\u5f84\u7684\u6784\u9020\u662f\u7eaf\u903b\u8f91\u5c42\u7684\u3002 \u53cd\u67e5\u62ff\u5230 target \u8282\u70b9\u540e&#xff0c;\u6cbf node.parent \u9010\u7ea7\u5411\u4e0a\u8d70\u5230\u9875\u9762\u6839&#xff0c;\u5c31\u5f97\u5230\u4e00\u6761\u5b8c\u6574\u7684\u8def\u5f84\u6570\u7ec4\u3002\u6ce8\u610f&#xff1a;\u8fd9\u6761\u8def\u5f84\u662f\u865a\u62df\u6811\u7684\u8def\u5f84&#xff0c;\u4e0d\u662f\u6e32\u67d3\u5c42\u6a21\u677f\u7684\u8def\u5f84\u3002 \u6e32\u67d3\u5c42\u53ea\u77e5\u9053\u88ab\u70b9\u51fb\u7684\u90a3\u4e2a\u8282\u70b9&#xff1b;\u300c\u54ea\u4e9b\u7956\u5148\u8282\u70b9\u7ed1\u4e86\u540c\u7c7b\u578b\u4e8b\u4ef6\u3001\u6309\u4ec0\u4e48\u987a\u5e8f\u6267\u884c\u300d&#xff0c;\u5168\u90e8\u7531\u903b\u8f91\u5c42\u6839\u636e\u865a\u62df\u6811\u81ea\u5df1\u63a8\u5bfc\u3002\u4e5f\u5c31\u662f\u8bf4&#xff0c;DOM \u7684\u4f20\u64ad\u8bed\u4e49\u5728\u6846\u67b6\u91cc\u88ab\u5f7b\u5e95\u300c\u91cd\u5efa\u300d\u4e86\u4e00\u904d\u2014\u2014\u6e32\u67d3\u5c42\u53ea\u8d1f\u8d23\u62a5\u544a\u300c\u70b9\u4e86\u8c01\u300d\u3002<\/p>\n<h4>3.3 dataset \u8bed\u4e49\u7684\u987a\u5e26\u4fee\u590d<\/h4>\n<p>\u8fd8\u6709\u4e00\u4e2a\u5bb9\u6613\u88ab\u5ffd\u89c6\u7684\u6536\u76ca\u3002\u539f\u751f\u5c0f\u7a0b\u5e8f\u7684 dataset \u6709\u4e0d\u5c11\u89c4\u77e9&#xff1a;\u5c5e\u6027\u540d\u5168\u5c0f\u5199\u3001\u8fde\u5b57\u7b26\u8f6c\u9a7c\u5cf0\u3001\u503c\u5fc5\u987b\u662f\u53ef\u5e8f\u5217\u5316\u6570\u636e\u3002\u5f00\u53d1\u8005\u4ece React \u4e16\u754c\u5e26\u6765\u7684 e.target.dataset \u4f7f\u7528\u4e60\u60ef&#xff08;\u5f80\u8282\u70b9\u4e0a\u6302\u81ea\u5b9a\u4e49\u6570\u636e\u3001\u5728\u59d4\u6258\u56de\u8c03\u91cc\u8bfb\u53d6&#xff09;\u5728\u539f\u751f\u91cc\u7ecf\u5e38\u8e29\u5751\u3002\u800c\u6846\u67b6 A \u7684\u65b9\u6848\u91cc&#xff0c;e.target \u5df2\u7ecf\u88ab resolve \u6210\u865a\u62df\u6811\u8282\u70b9&#xff0c;dataset \u7684\u53d6\u503c\u8d70\u7684\u662f\u865a\u62df\u8282\u70b9\u4e0a\u7684\u5c5e\u6027\u2014\u2014DOM \u7684 dataset \u5fc3\u667a\u88ab\u987a\u5e26\u4fdd\u7559\u4e86\u4e0b\u6765&#xff0c;\u800c\u4e0d\u662f\u8ba9 React \u5f00\u53d1\u8005\u53bb\u9002\u5e94\u5c0f\u7a0b\u5e8f\u7684 dataset \u602a\u7656\u3002\u8fd9\u4e5f\u662f\u300c\u6a21\u62df\u5c42\u300d\u7684\u4ef7\u503c\u6e05\u5355\u91cc\u5e38\u88ab\u6f0f\u6389\u7684\u4e00\u9879\u3002<\/p>\n<h4>3.4 \u9762\u8bd5\u8bdd\u672f\u5c0f\u7ed3<\/h4>\n<p>\u4e00\u53e5\u8bdd\u7248&#xff1a;<br \/>\n\u201c\u6e32\u67d3\u5c42\u548c\u903b\u8f91\u5c42\u4e4b\u95f4\u53ea\u80fd\u4f20\u53ef\u5e8f\u5217\u5316\u6570\u636e&#xff0c;\u4f20\u4e0d\u4e86\u8282\u70b9\u3002\u6846\u67b6\u5728\u7ed1\u5b9a\u65f6\u7ed9\u8282\u70b9\u751f\u6210 sid \u5e76\u5199\u8fdb\u6e32\u67d3\u6570\u636e\u7684 dataset&#xff0c;\u4e8b\u4ef6\u89e6\u53d1\u65f6\u4ece\u539f\u751f\u4e8b\u4ef6\u7684 target.dataset.sid \u53cd\u67e5\u8282\u70b9\u7f13\u5b58\u8868\u627e\u56de\u865a\u62df\u8282\u70b9&#xff0c;\u518d\u6cbf\u7236\u94fe\u6784\u9020\u5192\u6ce1\u8def\u5f84&#xff0c;\u914d\u5408\u4e8b\u4ef6\u540d\u5206\u7ec4\u5339\u914d\u5b8c\u6210\u6574\u4e2a\u4e8b\u4ef6\u94fe\u8def\u3002\u201d<\/p>\n<p>\u6df1\u5165\u7248&#xff1a;<br \/>\n\u201csid \u53cd\u67e5\u7684\u5173\u952e\u7ea6\u675f\u662f\u53cc\u7ebf\u7a0b\u53ea\u4f20 JSON&#xff1a;\u7ed1\u5b9a\u53d1\u751f\u65f6\u8282\u70b9\u7f13\u5b58\u8868\u767b\u8bb0 sid \u5230\u865a\u62df\u8282\u70b9\u7684\u6620\u5c04\u5e76\u968f\u5e8f\u5217\u5316\u4e0b\u53d1 dataset&#xff1b;\u89e6\u53d1\u65f6\u7528 sid \u52a0\u4e8b\u4ef6\u540d\u5171\u540c\u5b9a\u4f4d\u56de\u8c03\u96c6\u5408\u3002\u5192\u6ce1\u8def\u5f84\u5728\u903b\u8f91\u5c42\u6cbf\u865a\u62df\u6811\u7236\u94fe\u63a8\u5bfc&#xff0c;\u6e32\u67d3\u5c42\u53ea\u62a5\u544a\u70b9\u51fb\u76ee\u6807\u3001\u4e0d\u53c2\u4e0e\u4f20\u64ad&#xff0c;DOM \u4f20\u64ad\u8bed\u4e49\u88ab\u5b8c\u5168\u91cd\u5efa\u3002\u8fb9\u754c\u662f\u4e8b\u4ef6\u98de\u884c\u4e2d\u8282\u70b9\u5378\u8f7d\u4f1a\u5bfc\u81f4\u53cd\u67e5\u843d\u7a7a\u88ab\u9759\u9ed8\u4e22\u5f03\u2014\u2014\u6d4f\u89c8\u5668\u5185\u6838\u540c\u6b65\u4f20\u64ad\u6ca1\u6709\u8fd9\u4e2a\u95ee\u9898&#xff0c;\u6a21\u62df\u5c42\u9694\u4e00\u6b21\u7ebf\u7a0b\u901a\u4fe1&#xff0c;\u5feb\u7167\u53ef\u80fd\u8fc7\u671f\u3002\u53e6\u4e00\u4e2a\u6536\u76ca\u662f target \u88ab resolve \u6210\u865a\u62df\u8282\u70b9\u540e&#xff0c;dataset \u5fc3\u667a\u4e5f\u56de\u5230\u4e86 DOM \u4e60\u60ef\u3002\u201d<\/p>\n<hr \/>\n<h3>\u56db\u3001\u91cd\u5efa\u6355\u83b7-\u5192\u6ce1-\u59d4\u6258&#xff1a;\u628a DOM \u7684\u4f20\u64ad\u8bed\u4e49\u62fc\u5b8c\u6574<\/h3>\n<h4>4.1 \u5b8c\u6574\u7684\u4f20\u64ad\u5faa\u73af<\/h4>\n<p>\u524d\u4e09\u8282\u7684\u96f6\u4ef6\u51d1\u9f50\u4e86&#xff1a;\u4e8b\u4ef6\u4e2d\u5fc3\u63a5\u4f4f\u539f\u751f\u4e8b\u4ef6\u3001sid \u53cd\u67e5\u627e\u56de target\u3001\u5192\u6ce1\u8def\u5f84\u6cbf\u7236\u94fe\u6784\u9020\u3001\u5408\u6210\u4e8b\u4ef6\u5bf9\u8c61\u63d0\u4f9b target\/currentTarget \u4e0e stopPropagation\u3002\u73b0\u5728\u628a\u5b83\u4eec\u7ec4\u88c5\u6210\u4e00\u4e2a\u5b8c\u6574\u7684\u4f20\u64ad\u5faa\u73af&#xff1a;<\/p>\n<p><span class=\"token comment\">\/\/ \u7b80\u5316\u4f2a\u4ee3\u7801&#xff1a;\u5b8c\u6574\u7684\u4e8b\u4ef6\u4f20\u64ad\u6a21\u62df<\/span><br \/>\n<span class=\"token keyword\">function<\/span> <span class=\"token function\">dispatchSyntheticEvent<\/span><span class=\"token punctuation\">(<\/span><span class=\"token parameter\">nativeEvent<span class=\"token punctuation\">,<\/span> eventPath<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n  <span class=\"token keyword\">const<\/span> event <span class=\"token operator\">&#061;<\/span> <span class=\"token keyword\">new<\/span> <span class=\"token class-name\">SyntheticEvent<\/span><span class=\"token punctuation\">(<\/span>nativeEvent<span class=\"token punctuation\">,<\/span> eventPath<span class=\"token punctuation\">)<\/span><\/p>\n<p>  <span class=\"token comment\">\/\/ \u2460 \u6355\u83b7\u9636\u6bb5&#xff1a;\u4ece\u6839\u5411\u4e0b<\/span><br \/>\n  <span class=\"token keyword\">for<\/span> <span class=\"token punctuation\">(<\/span><span class=\"token keyword\">let<\/span> i <span class=\"token operator\">&#061;<\/span> eventPath<span class=\"token punctuation\">.<\/span>length <span class=\"token operator\">&#8211;<\/span> <span class=\"token number\">1<\/span><span class=\"token punctuation\">;<\/span> i <span class=\"token operator\">&gt;&#061;<\/span> <span class=\"token number\">1<\/span><span class=\"token punctuation\">;<\/span> i<span class=\"token operator\">&#8212;<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token function\">invokeHandlers<\/span><span class=\"token punctuation\">(<\/span>eventPath<span class=\"token punctuation\">[<\/span>i<span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">,<\/span> nativeEvent<span class=\"token punctuation\">.<\/span>type<span class=\"token punctuation\">,<\/span> event<span class=\"token punctuation\">,<\/span> <span class=\"token string\">&#039;capture&#039;<\/span><span class=\"token punctuation\">)<\/span><br \/>\n  <span class=\"token punctuation\">}<\/span><\/p>\n<p>  <span class=\"token comment\">\/\/ \u2461 \u76ee\u6807\u9636\u6bb5<\/span><br \/>\n  <span class=\"token function\">invokeHandlers<\/span><span class=\"token punctuation\">(<\/span>eventPath<span class=\"token punctuation\">[<\/span><span class=\"token number\">0<\/span><span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">,<\/span> nativeEvent<span class=\"token punctuation\">.<\/span>type<span class=\"token punctuation\">,<\/span> event<span class=\"token punctuation\">,<\/span> <span class=\"token string\">&#039;target&#039;<\/span><span class=\"token punctuation\">)<\/span><\/p>\n<p>  <span class=\"token comment\">\/\/ \u2462 \u5192\u6ce1\u9636\u6bb5&#xff1a;\u4ece\u76ee\u6807\u5411\u4e0a<\/span><br \/>\n  <span class=\"token keyword\">for<\/span> <span class=\"token punctuation\">(<\/span><span class=\"token keyword\">let<\/span> i <span class=\"token operator\">&#061;<\/span> <span class=\"token number\">1<\/span><span class=\"token punctuation\">;<\/span> i <span class=\"token operator\">&lt;<\/span> eventPath<span class=\"token punctuation\">.<\/span>length<span class=\"token punctuation\">;<\/span> i<span class=\"token operator\">&#043;&#043;<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token keyword\">if<\/span> <span class=\"token punctuation\">(<\/span>event<span class=\"token punctuation\">.<\/span>_stopped<span class=\"token punctuation\">)<\/span> <span class=\"token keyword\">break<\/span><br \/>\n    event<span class=\"token punctuation\">.<\/span>_currentIndex <span class=\"token operator\">&#061;<\/span> i          <span class=\"token comment\">\/\/ currentTarget \u6307\u9488<\/span><br \/>\n    <span class=\"token function\">invokeHandlers<\/span><span class=\"token punctuation\">(<\/span>eventPath<span class=\"token punctuation\">[<\/span>i<span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">,<\/span> nativeEvent<span class=\"token punctuation\">.<\/span>type<span class=\"token punctuation\">,<\/span> event<span class=\"token punctuation\">,<\/span> <span class=\"token string\">&#039;bubble&#039;<\/span><span class=\"token punctuation\">)<\/span><br \/>\n  <span class=\"token punctuation\">}<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p>\u4e09\u4e2a\u9636\u6bb5\u5408\u8d77\u6765&#xff0c;DOM \u7684\u5b8c\u6574\u4f20\u64ad\u6a21\u578b\u5c31\u590d\u523b\u4e86\u3002\u6ce8\u610f\u8fd9\u4e00\u5207\u7684\u843d\u70b9&#xff1a;React \u5f00\u53d1\u8005\u65e5\u5e38\u5199\u7684\u4e1c\u897f\u2014\u2014e.target.dataset\u3001e.currentTarget\u3001\u5b50\u5143\u7d20\u56de\u8c03\u91cc e.stopPropagation()\u3001\u628a\u70b9\u51fb\u56de\u8c03\u7ed1\u5728\u7236\u5bb9\u5668\u4e0a\u505a\u4e8b\u4ef6\u59d4\u6258\u2014\u2014\u5168\u90e8\u9010\u9879\u53ef\u7528\u3002 \u59d4\u6258\u5c24\u5176\u503c\u5f97\u70b9\u7834&#xff1a;\u56e0\u4e3a\u56de\u8c03\u662f\u7ed1\u5728\u865a\u62df\u6811\u7684\u7236\u8282\u70b9\u4e0a\u7684&#xff0c;sid \u53cd\u67e5\u627e\u56de\u7684\u662f\u6700\u6df1\u7684\u5b50\u8282\u70b9&#xff0c;\u5192\u6ce1\u81ea\u7136\u4f1a\u8def\u8fc7\u7236\u8282\u70b9\u5e76\u6267\u884c\u5176\u56de\u8c03\u2014\u2014\u300c\u7236\u8282\u70b9\u6536\u5b50\u4e8b\u4ef6\u300d\u7684\u59d4\u6258\u6a21\u5f0f\u4e0d\u9700\u8981\u4efb\u4f55\u989d\u5916\u673a\u5236&#xff0c;\u662f\u5192\u6ce1\u6a21\u62df\u7684\u514d\u8d39\u8d60\u54c1\u3002<\/p>\n<h4>4.2 \u4e8b\u4ef6\u5904\u7406\u51fd\u6570\u600e\u4e48\u62ff\u5230\u9875\u9762\u4e0a\u4e0b\u6587&#xff1a;Current \u5355\u4f8b<\/h4>\n<p>\u8fd8\u6709\u4e00\u4e2a\u914d\u5957\u8bbe\u8ba1\u5bb9\u6613\u88ab\u6f0f\u6389&#xff1a;\u4e1a\u52a1\u56de\u8c03\u91cc\u7ecf\u5e38\u8981\u7528\u5f53\u524d\u9875\u9762\u7684\u8def\u7531\u53c2\u6570\u3001\u5168\u5c40\u72b6\u6001\u3002React\/Vue \u7684\u56de\u8c03\u51fd\u6570\u8131\u79bb\u4e86\u7ec4\u4ef6\u95ed\u5305\u540e&#xff0c;\u6846\u67b6\u600e\u4e48\u7ed9\u5b83\u63d0\u4f9b\u300c\u6211\u662f\u54ea\u4e2a\u9875\u9762\u300d\u7684\u4e0a\u4e0b\u6587&#xff1f;<\/p>\n<p>\u6846\u67b6 A \u7684\u7b54\u6848\u662f\u4e00\u4e2a\u6781\u7b80\u7684\u5168\u5c40\u5355\u4f8b&#xff1a;<\/p>\n<p><span class=\"token comment\">\/\/ \u7b80\u5316\u4f2a\u4ee3\u7801&#xff1a;\u5168\u5c40\u4e0a\u4e0b\u6587\u5355\u4f8b<\/span><br \/>\n<span class=\"token keyword\">const<\/span> Current <span class=\"token operator\">&#061;<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n  <span class=\"token literal-property property\">app<\/span><span class=\"token operator\">:<\/span> <span class=\"token keyword\">null<\/span><span class=\"token punctuation\">,<\/span>      <span class=\"token comment\">\/\/ \u5f53\u524d\u5e94\u7528\u5b9e\u4f8b<\/span><br \/>\n  <span class=\"token literal-property property\">router<\/span><span class=\"token operator\">:<\/span> <span class=\"token keyword\">null<\/span><span class=\"token punctuation\">,<\/span>   <span class=\"token comment\">\/\/ \u5f53\u524d\u8def\u7531\u5668<\/span><br \/>\n  <span class=\"token literal-property property\">page<\/span><span class=\"token operator\">:<\/span> <span class=\"token keyword\">null<\/span>      <span class=\"token comment\">\/\/ \u5f53\u524d\u9875\u9762&#xff08;\u865a\u62df\u6811\u7684\u6839\u8282\u70b9&#xff09;<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p><span class=\"token comment\">\/\/ \u9875\u9762 onLoad \u65f6\u5207\u6362\u4e0a\u4e0b\u6587<\/span><br \/>\n<span class=\"token keyword\">function<\/span> <span class=\"token function\">onPageLoad<\/span><span class=\"token punctuation\">(<\/span><span class=\"token parameter\">page<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n  Current<span class=\"token punctuation\">.<\/span>page <span class=\"token operator\">&#061;<\/span> page<br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p><span class=\"token comment\">\/\/ \u5bf9\u5916 API&#xff1a;\u56de\u8c03\u91cc\u53d6\u5f53\u524d\u5b9e\u4f8b<\/span><br \/>\n<span class=\"token keyword\">function<\/span> <span class=\"token function\">getCurrentInstance<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n  <span class=\"token keyword\">return<\/span> <span class=\"token punctuation\">{<\/span> <span class=\"token literal-property property\">app<\/span><span class=\"token operator\">:<\/span> Current<span class=\"token punctuation\">.<\/span>app<span class=\"token punctuation\">,<\/span> <span class=\"token literal-property property\">page<\/span><span class=\"token operator\">:<\/span> Current<span class=\"token punctuation\">.<\/span>page<span class=\"token punctuation\">,<\/span> <span class=\"token literal-property property\">router<\/span><span class=\"token operator\">:<\/span> Current<span class=\"token punctuation\">.<\/span>router <span class=\"token punctuation\">}<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p>\u4e8b\u4ef6\u4e2d\u5fc3\u5206\u53d1\u56de\u8c03\u524d&#xff0c;Current.page \u5df2\u7ecf\u6307\u5411\u5f53\u524d\u6d3b\u8dc3\u9875\u9762\u2014\u2014\u4e8e\u662f\u4efb\u4f55\u4e00\u4e2a\u4e8b\u4ef6\u5904\u7406\u51fd\u6570\u91cc\u8c03 getCurrentInstance()&#xff0c;\u90fd\u80fd\u62ff\u5230\u6b63\u786e\u4e0a\u4e0b\u6587\u3002\u8bbe\u8ba1\u53ea\u6709\u4e8c\u5341\u51e0\u884c&#xff0c;\u4f46\u5b83\u7684\u6b63\u786e\u6027\u4f9d\u8d56\u4e00\u4e2a\u65f6\u5e8f\u524d\u63d0&#xff1a;\u540c\u4e00\u65f6\u523b\u53ea\u6709\u4e00\u4e2a\u9875\u9762\u5728\u5904\u7406\u4e8b\u4ef6\u3002 \u5c0f\u7a0b\u5e8f\u7684\u9875\u9762\u6808\u6a21\u578b\u57fa\u672c\u6ee1\u8db3\u8fd9\u4e2a\u524d\u63d0&#xff08;\u540e\u53f0\u9875\u9762\u7684\u56de\u8c03\u4e0d\u4f1a\u88ab\u89e6\u53d1&#xff09;&#xff0c;\u4f46\u5982\u679c\u4f60\u5728\u81ea\u5b9a\u4e49\u5bb9\u5668\u6216\u9884\u6e32\u67d3\u573a\u666f\u91cc\u6253\u7834\u5b83&#xff0c;\u5c31\u8981\u5c0f\u5fc3\u4e86\u2014\u2014\u8fd9\u4e5f\u662f\u8bfb\u6e90\u7801\u65f6\u624d\u80fd\u610f\u8bc6\u5230\u7684\u9690\u542b\u5951\u7ea6\u3002<\/p>\n<h4>4.3 \u4e24\u6761\u8def\u7ebf\u6700\u950b\u5229\u7684\u5bf9\u7167<\/h4>\n<p>\u81f3\u6b64&#xff0c;\u53ef\u4ee5\u653e\u4e0a\u672c\u7cfb\u5217\u6700\u503c\u5f97\u53cd\u590d\u54c1\u5473\u7684\u4e00\u7ec4\u5bf9\u7167\u3002\u540c\u4e00\u4e2a\u95ee\u9898&#xff1a;\u4ea4\u4e92\u7684\u6027\u80fd\u3002<\/p>\n<table>\n<tr>\u8de8\u7aef\u6846\u67b6 A\u539f\u751f\u7ec4\u4ef6\u5e93 B<\/tr>\n<tbody>\n<tr>\n<td>\u95ee\u9898<\/td>\n<td>\u903b\u8f91\u5c42\u6ca1\u6709 DOM \u4e8b\u4ef6&#xff0c;\u8bed\u4e49\u8981\u91cd\u5efa<\/td>\n<td>\u9ad8\u9891\u624b\u52bf\u8d70\u53cc\u7ebf\u7a0b\u901a\u4fe1&#xff0c;\u5ef6\u8fdf\u53d7\u4e0d\u4e86<\/td>\n<\/tr>\n<tr>\n<td>\u8def\u7ebf<\/td>\n<td>\u5728\u903b\u8f91\u5c42\u91cd\u5efa\u5b8c\u6574\u4e8b\u4ef6\u6a21\u578b<\/td>\n<td>\u628a\u903b\u8f91\u63a8\u5230\u6e32\u67d3\u7ebf\u7a0b<\/td>\n<\/tr>\n<tr>\n<td>\u624b\u6bb5<\/td>\n<td>\u4e8b\u4ef6\u4e2d\u5fc3 &#043; sid \u53cd\u67e5 &#043; \u6a21\u62df\u6355\u83b7\/\u5192\u6ce1<\/td>\n<td>\u624b\u52bf\u903b\u8f91\u5199\u8fdb\u89c6\u56fe\u5c42\u811a\u672c&#xff0c;\u5728\u6e32\u67d3\u7ebf\u7a0b\u6267\u884c<\/td>\n<\/tr>\n<tr>\n<td>\u56de\u4f20<\/td>\n<td>\u4e0d\u6d89\u53ca&#xff08;\u5168\u7a0b\u903b\u8f91\u5c42\u5185\u5b8c\u6210&#xff09;<\/td>\n<td>\u6865\u63a5\u65b9\u6cd5\u628a\u7ed3\u679c\u4f20\u56de\u903b\u8f91\u5c42&#xff0c;\u518d\u89e6\u53d1\u81ea\u5b9a\u4e49\u4e8b\u4ef6<\/td>\n<\/tr>\n<tr>\n<td>\u4ed8\u7684\u4ee3\u4ef7<\/td>\n<td>\u53cd\u67e5\/\u8def\u5f84\u6784\u9020\/\u5bf9\u8c61\u5305\u88c5\u7684\u6027\u80fd\u7a0e<\/td>\n<td>\u5e73\u53f0\u65b9\u8a00\u7ed1\u5b9a &#043; \u53cc\u4efd\u903b\u8f91\u7ef4\u62a4<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u539f\u751f\u7ec4\u4ef6\u5e93 B \u5904\u7406\u9ad8\u9891\u624b\u52bf&#xff08;\u4f8b\u5982\u5de6\u6ed1\u51fa\u73b0\u64cd\u4f5c\u6309\u94ae\u7684\u6ed1\u52a8\u83dc\u5355&#xff09;\u7684\u601d\u8def\u5b8c\u5168\u76f8\u53cd&#xff1a;\u624b\u52bf\u903b\u8f91\u76f4\u63a5\u5199\u5728\u89c6\u56fe\u5c42\u811a\u672c\u91cc&#xff0c;\u8dd1\u5728\u6e32\u67d3\u7ebf\u7a0b&#xff0c;\u89e6\u6478\u7684\u6bcf\u4e00\u5e27\u90fd\u5728\u6e32\u67d3\u7ebf\u7a0b\u5c31\u5730\u54cd\u5e94&#xff0c;\u4e0d\u8de8\u7ebf\u7a0b&#xff1b;\u6ed1\u52a8\u7ed3\u675f\u624d\u901a\u8fc7\u6865\u63a5\u65b9\u6cd5\u628a\u7ed3\u679c&#xff08;\u201c\u7528\u6237\u9009\u4e86\u5220\u9664\u201d&#xff09;\u4f20\u56de\u903b\u8f91\u5c42&#xff0c;\u89e6\u53d1\u81ea\u5b9a\u4e49\u4e8b\u4ef6\u3002\u6846\u67b6 A \u662f\u628a DOM \u8bed\u4e49\u642c\u8fdb\u903b\u8f91\u5c42&#xff0c;\u7ec4\u4ef6\u5e93 B \u662f\u628a\u4ea4\u4e92\u903b\u8f91\u642c\u51fa\u903b\u8f91\u5c42\u2014\u2014\u65b9\u5411\u6070\u597d\u76f8\u53cd&#xff0c;\u4f46\u90fd\u7cbe\u51c6\u6253\u5728\u5404\u81ea\u8981\u5bb3\u4e0a&#xff1a;\u6846\u67b6 A \u8981\u7684\u662f React\/Vue \u5fc3\u667a\u517c\u5bb9&#xff0c;\u7ec4\u4ef6\u5e93 B \u8981\u7684\u662f\u89e6\u6478\u8ddf\u968f\u96f6\u5ef6\u8fdf\u3002<\/p>\n<h4>4.4 \u9762\u8bd5\u8bdd\u672f\u5c0f\u7ed3<\/h4>\n<p>\u4e00\u53e5\u8bdd\u7248&#xff1a;<br \/>\n\u201c\u6846\u67b6\u7528\u6355\u83b7-\u76ee\u6807-\u5192\u6ce1\u4e09\u6bb5\u5faa\u73af\u52a0 currentTarget \u6307\u9488\u91cd\u5efa\u5b8c\u6574 DOM \u4f20\u64ad\u8bed\u4e49&#xff0c;\u4e8b\u4ef6\u59d4\u6258\u662f\u5192\u6ce1\u6a21\u62df\u7684\u514d\u8d39\u8d60\u54c1&#xff1b;\u914d\u5957\u4e00\u4e2a\u5168\u5c40\u5355\u4f8b Current \u6301\u6709\u5f53\u524d app\/router\/page&#xff0c;\u8ba9\u4efb\u4f55\u4e8b\u4ef6\u56de\u8c03\u90fd\u80fd\u901a\u8fc7 getCurrentInstance \u62ff\u5230\u9875\u9762\u4e0a\u4e0b\u6587\u3002\u539f\u751f\u8def\u7ebf\u5219\u628a\u624b\u52bf\u903b\u8f91\u5199\u8fdb\u89c6\u56fe\u5c42\u811a\u672c\u8dd1\u5728\u6e32\u67d3\u7ebf\u7a0b&#xff0c;\u7528\u6865\u63a5\u65b9\u6cd5\u56de\u4f20\u7ed3\u679c\u2014\u2014\u540c\u4e00\u4e2a\u4ea4\u4e92\u6027\u80fd\u95ee\u9898&#xff0c;\u4e00\u4e2a\u5411\u903b\u8f91\u5c42\u642c\u8bed\u4e49&#xff0c;\u4e00\u4e2a\u5411\u6e32\u67d3\u7ebf\u7a0b\u642c\u903b\u8f91\u3002\u201d<\/p>\n<p>\u6df1\u5165\u7248&#xff1a;<br \/>\n\u201c\u4e09\u6bb5\u5faa\u73af\u91cc currentTarget \u7684 getter \u8bfb\u6267\u884c\u6307\u9488&#xff0c;stopPropagation \u662f\u6807\u5fd7\u4f4d\u8ba9\u5192\u6ce1\u63d0\u524d break&#xff1b;\u59d4\u6258\u6a21\u5f0f\u4e0d\u9700\u8981\u989d\u5916\u673a\u5236&#xff0c;\u56e0\u4e3a\u56de\u8c03\u7ed1\u5728\u865a\u62df\u6811\u7236\u8282\u70b9\u4e0a\u3001\u5192\u6ce1\u81ea\u7136\u8def\u8fc7\u3002Current \u5355\u4f8b\u4e8c\u5341\u51e0\u884c&#xff0c;\u6b63\u786e\u6027\u4f9d\u8d56\u2019\u540c\u4e00\u65f6\u523b\u53ea\u6709\u4e00\u4e2a\u9875\u9762\u5728\u5904\u7406\u4e8b\u4ef6\u2019\u7684\u65f6\u5e8f\u5951\u7ea6\u3002\u4e24\u6761\u8def\u7ebf\u5bf9\u7167\u7684\u672c\u8d28\u662f\u76ee\u6807\u4e0d\u540c&#xff1a;\u6846\u67b6\u4e70\u7684\u662f React \u5f00\u53d1\u8005\u7684\u96f6\u6210\u672c\u8fc1\u79fb&#xff0c;\u4ee3\u4ef7\u662f\u6bcf\u4e2a\u4e8b\u4ef6\u90fd\u8981\u53cd\u67e5\u6784\u9020\u8def\u5f84\u5305\u88c5\u5bf9\u8c61\u7684\u6027\u80fd\u7a0e&#xff1b;\u539f\u751f\u7ec4\u4ef6\u5e93\u4e70\u7684\u662f\u89e6\u6478\u8ddf\u968f\u7684\u96f6\u5ef6\u8fdf&#xff0c;\u4ee3\u4ef7\u662f\u5e73\u53f0\u65b9\u8a00\u7ed1\u5b9a\u548c\u903b\u8f91\u53cc\u4efd\u7ef4\u62a4\u3002\u9009\u578b\u65f6\u5148\u95ee\u4f60\u8981\u4e70\u7684\u662f\u4ec0\u4e48\u3002\u201d<\/p>\n<hr \/>\n<h3>\u6536\u5c3e&#xff1a;\u6a21\u62df\u5c42\u7684\u8d26\u5355<\/h3>\n<p>\u628a\u8fd9\u7bc7\u6587\u7ae0\u6536\u655b\u6210\u4e00\u5f20\u8d26\u5355\u3002<\/p>\n<p>\u8bed\u4e49\u6536\u76ca&#xff08;\u4e70\u5230\u7684&#xff09;&#xff1a; e.target.dataset \/ e.currentTarget \/ e.stopPropagation() \/ \u4e8b\u4ef6\u59d4\u6258 \/ DOM \u5f0f dataset \u5fc3\u667a\u2014\u2014React \u5f00\u53d1\u8005\u7684\u6574\u5757\u808c\u8089\u8bb0\u5fc6\u5e73\u79fb\u8fc7\u6765&#xff0c;\u96f6\u91cd\u5b66\u6210\u672c\u3002\u8fd9\u4e9b\u8bed\u4e49\u6ca1\u6709\u4efb\u4f55\u4e00\u4e2a\u662f\u5e73\u53f0\u63d0\u4f9b\u7684&#xff0c;\u5168\u90e8\u662f\u6a21\u62df\u5c42\u7684\u4ea7\u51fa\u3002<\/p>\n<p>\u6027\u80fd\u7a0e&#xff08;\u4ed8\u51fa\u7684&#xff09;&#xff1a; \u6bcf\u6b21\u4e8b\u4ef6\u90fd\u8981\u7ecf\u5386\u300c\u4e8b\u4ef6\u4e2d\u5fc3\u63a5\u4f4f \u2192 sid \u53cd\u67e5 \u2192 \u8def\u5f84\u6784\u9020 \u2192 \u5408\u6210\u5bf9\u8c61\u5305\u88c5 \u2192 \u4e09\u6bb5\u5faa\u73af\u300d\u3002\u6846\u67b6\u7528\u4e24\u4e2a\u8bbe\u8ba1\u628a\u7a0e\u538b\u5230\u6700\u4f4e&#xff1a;target\/currentTarget \u7684 getter \u60f0\u6027\u6c42\u503c&#xff08;\u4e0d\u8bfb\u4e0d\u53cd\u67e5&#xff09;&#xff0c;\u4ee5\u53ca sid \u52a0\u4e8b\u4ef6\u540d\u5b9a\u4f4d\u56de\u8c03\u96c6\u5408&#xff08;\u4e0d\u904d\u5386&#xff09;\u3002\u4f46\u6a21\u62df\u5c42\u6539\u53d8\u4e0d\u4e86\u4e00\u4e2a\u4e8b\u5b9e&#xff1a;\u4e8b\u4ef6\u4ece\u7269\u7406\u70b9\u51fb\u5230\u56de\u8c03\u6267\u884c&#xff0c;\u6c38\u8fdc\u6bd4\u539f\u751f\u8def\u7ebf\u591a\u8d70\u4e00\u5c42\u5305\u88c5&#xff0c;\u4e14\u5192\u6ce1\u4f20\u64ad\u9694\u7740\u4e00\u6b21\u7ebf\u7a0b\u901a\u4fe1&#xff0c;\u5feb\u7167\u53ef\u80fd\u8fc7\u671f\u3002<\/p>\n<p>\u8fd9\u7ec4\u6743\u8861\u662f\u53ef\u4ee5\u76f4\u63a5\u8fc1\u79fb\u5230\u4f60\u81ea\u5df1\u7684\u6280\u672f\u51b3\u7b56\u91cc\u7684&#xff1a;\u5f53\u4f60\u9700\u8981\u5728\u7f3a\u5931\u67d0\u79cd\u5e95\u5c42\u80fd\u529b\u7684\u73af\u5883\u91cc\u517c\u5bb9\u4e0a\u5c42\u5fc3\u667a\u65f6&#xff0c;\u95ee\u4e09\u4e2a\u95ee\u9898\u2014\u2014\u6a21\u62df\u70b9\u653e\u5728\u54ea\u4e00\u5c42&#xff08;\u53ef\u66ff\u6362\u7684\u94a9\u5b50\u70b9 vs \u786c\u7f16\u7801&#xff09;\u3001\u6a21\u62df\u6210\u672c\u80fd\u4e0d\u80fd\u60f0\u6027\u5316&#xff08;\u4e0d\u8bbf\u95ee\u4e0d\u4ed8\u8d39&#xff09;\u3001\u6a21\u62df\u8bed\u4e49\u7684\u8fb9\u754c\u5728\u54ea&#xff08;\u5feb\u7167\u8fc7\u671f\u3001\u65f6\u5e8f\u5951\u7ea6&#xff09;\u3002 \u8fd9\u4e09\u4e2a\u95ee\u9898\u5206\u522b\u5bf9\u5e94\u672c\u6587\u7684\u4e8b\u4ef6\u4e2d\u5fc3\u3001getter \u60f0\u6027\u6c42\u503c\u548c Current \u5355\u4f8b\u2014\u2014\u4e09\u4e2a\u7b54\u6848\u90fd\u5199\u5728\u6e90\u7801\u91cc&#xff0c;\u800c\u4e0d\u662f\u6587\u6863\u91cc\u3002<\/p>\n<p>\u672c\u6587\u662f\u300c\u5c0f\u7a0b\u5e8f\u53cc\u8def\u7ebf\u6e90\u7801\u62c6\u89e3\u300d\u7cfb\u5217\u7684\u53c8\u4e00\u7bc7\u5355\u70b9\u6df1\u6316\u3002\u4e0b\u4e00\u7bc7\u6211\u4eec\u7ee7\u7eed\u5355\u62c6&#xff1a;\u589e\u91cf\u66f4\u65b0\u8c03\u5ea6\u5668\u2014\u2014\u8def\u5f84\u53bb\u91cd\u7684\u5177\u4f53\u7b97\u6cd5\u3001\u4e3a\u4ec0\u4e48\u7528 setTimeout \u800c\u4e0d\u662f\u5fae\u4efb\u52a1\u7684\u65f6\u5e8f\u8bc1\u660e\u3001\u5c40\u90e8\u66f4\u65b0\u5bb9\u5668\u7684\u67e5\u627e\u4e0e\u7f13\u5b58&#xff0c;\u5168\u90e8\u6e90\u7801\u7ea7\u5c55\u5f00\u3002\u611f\u5174\u8da3\u7684\u8bdd\u5173\u6ce8\u4e00\u4e0b&#xff0c;\u66f4\u65b0\u4f1a\u7b2c\u4e00\u65f6\u95f4\u63a8\u9001\u3002<\/p>\n<hr \/>\n<p>\u672c\u6587\u6d89\u53ca\u7684\u4ee3\u7801\u5747\u4e3a\u57fa\u4e8e\u6e90\u7801\u8bbe\u8ba1\u601d\u8def\u91cd\u5199\u7684\u7b80\u5316\u4f2a\u4ee3\u7801&#xff0c;\u4ec5\u7528\u4e8e\u6280\u672f\u4ea4\u6d41&#xff0c;\u4e0d\u4ee3\u8868\u4efb\u4f55\u9879\u76ee\u7684\u771f\u5b9e\u5b9e\u73b0&#xff1b;\u6587\u4e2d\u4ee3\u79f0\u4e0e\u771f\u5b9e\u9879\u76ee\u65e0\u5173\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u8bf4\u660e&#xff1a;\u672c\u6587\u5206\u6790\u5bf9\u8c61\u4e3a\u5f00\u6e90\u9879\u76ee&#xff0c;\u51fa\u4e8e\u5408\u89c4\u8003\u8651&#xff0c;\u6587\u4e2d\u4ee5\u300c\u8de8\u7aef\u6846\u67b6 A\u300d&#xff08;\u4e00\u5957\u4ee3\u7801\u7f16\u8bd1\u5230\u591a\u7aef\u7684\u6846\u67b6&#xff09;\u3001\u300c\u539f\u751f\u7ec4\u4ef6\u5e93 B\u300d&#xff08;\u67d0\u5c0f\u7a0b\u5e8f\u5e73\u53f0\u5b98\u65b9 UI \u7ec4\u4ef6\u5e93&#xff09;\u7b49\u4ee3\u79f0\u6307\u4ee3&#xff0c;\u4ee3\u7801\u5747\u4e3a\u91cd\u5199\u540e\u7684\u7b80\u5316\u4f2a\u4ee3\u7801&#xff0c;\u4ec5\u7528\u4e8e\u8bf4\u660e\u8bbe\u8ba1\u601d\u8def&#xff0c;\u4e0e\u771f\u5b9e\u6e90\u7801\u5b58\u5728\u5dee\u5f02\u3002\u5f15\u8a00&#xff1a;\u4f60\u5728 React \u91cc\u5199\u7684 e.stopPropagation()&#xff0c;\u4e3a\u4ec0\u4e48\u5728\u5c0f\u7a0b<\/p>\n","protected":false},"author":2,"featured_media":114801,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[13062,723,556],"topic":[],"class_list":["post-114802","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-13062","tag-react","tag-556"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u9762\u8bd5\u5b98\u95ee\u6211\uff1a\u5c0f\u7a0b\u5e8f\u6ca1\u6709 DOM\uff0cReact \u7684 e.stopPropagation() \u4e3a\u4ec0\u4e48\u8fd8\u80fd\u751f\u6548\uff1f\u6211\u5f53\u573a\u8bb2\u900f\u4e86\u8fd9\u5957\u5408\u6210\u4e8b\u4ef6\u7cfb\u7edf - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/114802.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u9762\u8bd5\u5b98\u95ee\u6211\uff1a\u5c0f\u7a0b\u5e8f\u6ca1\u6709 DOM\uff0cReact \u7684 e.stopPropagation() \u4e3a\u4ec0\u4e48\u8fd8\u80fd\u751f\u6548\uff1f\u6211\u5f53\u573a\u8bb2\u900f\u4e86\u8fd9\u5957\u5408\u6210\u4e8b\u4ef6\u7cfb\u7edf - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u8bf4\u660e&#xff1a;\u672c\u6587\u5206\u6790\u5bf9\u8c61\u4e3a\u5f00\u6e90\u9879\u76ee&#xff0c;\u51fa\u4e8e\u5408\u89c4\u8003\u8651&#xff0c;\u6587\u4e2d\u4ee5\u300c\u8de8\u7aef\u6846\u67b6 A\u300d&#xff08;\u4e00\u5957\u4ee3\u7801\u7f16\u8bd1\u5230\u591a\u7aef\u7684\u6846\u67b6&#xff09;\u3001\u300c\u539f\u751f\u7ec4\u4ef6\u5e93 B\u300d&#xff08;\u67d0\u5c0f\u7a0b\u5e8f\u5e73\u53f0\u5b98\u65b9 UI \u7ec4\u4ef6\u5e93&#xff09;\u7b49\u4ee3\u79f0\u6307\u4ee3&#xff0c;\u4ee3\u7801\u5747\u4e3a\u91cd\u5199\u540e\u7684\u7b80\u5316\u4f2a\u4ee3\u7801&#xff0c;\u4ec5\u7528\u4e8e\u8bf4\u660e\u8bbe\u8ba1\u601d\u8def&#xff0c;\u4e0e\u771f\u5b9e\u6e90\u7801\u5b58\u5728\u5dee\u5f02\u3002\u5f15\u8a00&#xff1a;\u4f60\u5728 React \u91cc\u5199\u7684 e.stopPropagation()&#xff0c;\u4e3a\u4ec0\u4e48\u5728\u5c0f\u7a0b\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/114802.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-10-10T01:41:19+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261010014116-6ac997bce4d76.png\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/114802.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/114802.html\",\"name\":\"\u9762\u8bd5\u5b98\u95ee\u6211\uff1a\u5c0f\u7a0b\u5e8f\u6ca1\u6709 DOM\uff0cReact \u7684 e.stopPropagation() \u4e3a\u4ec0\u4e48\u8fd8\u80fd\u751f\u6548\uff1f\u6211\u5f53\u573a\u8bb2\u900f\u4e86\u8fd9\u5957\u5408\u6210\u4e8b\u4ef6\u7cfb\u7edf - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-10-10T01:41:19+00:00\",\"dateModified\":\"2026-10-10T01:41:19+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/114802.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/114802.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/114802.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u9762\u8bd5\u5b98\u95ee\u6211\uff1a\u5c0f\u7a0b\u5e8f\u6ca1\u6709 DOM\uff0cReact \u7684 e.stopPropagation() \u4e3a\u4ec0\u4e48\u8fd8\u80fd\u751f\u6548\uff1f\u6211\u5f53\u573a\u8bb2\u900f\u4e86\u8fd9\u5957\u5408\u6210\u4e8b\u4ef6\u7cfb\u7edf\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u9762\u8bd5\u5b98\u95ee\u6211\uff1a\u5c0f\u7a0b\u5e8f\u6ca1\u6709 DOM\uff0cReact \u7684 e.stopPropagation() \u4e3a\u4ec0\u4e48\u8fd8\u80fd\u751f\u6548\uff1f\u6211\u5f53\u573a\u8bb2\u900f\u4e86\u8fd9\u5957\u5408\u6210\u4e8b\u4ef6\u7cfb\u7edf - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/114802.html","og_locale":"zh_CN","og_type":"article","og_title":"\u9762\u8bd5\u5b98\u95ee\u6211\uff1a\u5c0f\u7a0b\u5e8f\u6ca1\u6709 DOM\uff0cReact \u7684 e.stopPropagation() \u4e3a\u4ec0\u4e48\u8fd8\u80fd\u751f\u6548\uff1f\u6211\u5f53\u573a\u8bb2\u900f\u4e86\u8fd9\u5957\u5408\u6210\u4e8b\u4ef6\u7cfb\u7edf - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u8bf4\u660e&#xff1a;\u672c\u6587\u5206\u6790\u5bf9\u8c61\u4e3a\u5f00\u6e90\u9879\u76ee&#xff0c;\u51fa\u4e8e\u5408\u89c4\u8003\u8651&#xff0c;\u6587\u4e2d\u4ee5\u300c\u8de8\u7aef\u6846\u67b6 A\u300d&#xff08;\u4e00\u5957\u4ee3\u7801\u7f16\u8bd1\u5230\u591a\u7aef\u7684\u6846\u67b6&#xff09;\u3001\u300c\u539f\u751f\u7ec4\u4ef6\u5e93 B\u300d&#xff08;\u67d0\u5c0f\u7a0b\u5e8f\u5e73\u53f0\u5b98\u65b9 UI \u7ec4\u4ef6\u5e93&#xff09;\u7b49\u4ee3\u79f0\u6307\u4ee3&#xff0c;\u4ee3\u7801\u5747\u4e3a\u91cd\u5199\u540e\u7684\u7b80\u5316\u4f2a\u4ee3\u7801&#xff0c;\u4ec5\u7528\u4e8e\u8bf4\u660e\u8bbe\u8ba1\u601d\u8def&#xff0c;\u4e0e\u771f\u5b9e\u6e90\u7801\u5b58\u5728\u5dee\u5f02\u3002\u5f15\u8a00&#xff1a;\u4f60\u5728 React \u91cc\u5199\u7684 e.stopPropagation()&#xff0c;\u4e3a\u4ec0\u4e48\u5728\u5c0f\u7a0b","og_url":"https:\/\/www.wsisp.com\/helps\/114802.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-10-10T01:41:19+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261010014116-6ac997bce4d76.png"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"6 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/114802.html","url":"https:\/\/www.wsisp.com\/helps\/114802.html","name":"\u9762\u8bd5\u5b98\u95ee\u6211\uff1a\u5c0f\u7a0b\u5e8f\u6ca1\u6709 DOM\uff0cReact \u7684 e.stopPropagation() \u4e3a\u4ec0\u4e48\u8fd8\u80fd\u751f\u6548\uff1f\u6211\u5f53\u573a\u8bb2\u900f\u4e86\u8fd9\u5957\u5408\u6210\u4e8b\u4ef6\u7cfb\u7edf - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-10-10T01:41:19+00:00","dateModified":"2026-10-10T01:41:19+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/114802.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/114802.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/114802.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u9762\u8bd5\u5b98\u95ee\u6211\uff1a\u5c0f\u7a0b\u5e8f\u6ca1\u6709 DOM\uff0cReact \u7684 e.stopPropagation() \u4e3a\u4ec0\u4e48\u8fd8\u80fd\u751f\u6548\uff1f\u6211\u5f53\u573a\u8bb2\u900f\u4e86\u8fd9\u5957\u5408\u6210\u4e8b\u4ef6\u7cfb\u7edf"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/114802","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=114802"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/114802\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/114801"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=114802"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=114802"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=114802"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=114802"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}