{"id":27681,"date":"2024-11-24T09:43:13","date_gmt":"2024-11-24T01:43:13","guid":{"rendered":"https:\/\/fwq.ai\/blog\/27681\/"},"modified":"2024-11-24T09:43:13","modified_gmt":"2024-11-24T01:43:13","slug":"%e4%b8%ba%e4%bb%80%e4%b9%88%e7%82%b9%e5%87%bb%e5%bc%80%e5%85%b3%e6%8c%89%e9%92%ae%e6%b2%a1%e6%9c%89%e5%8f%8d%e5%ba%94%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/27681\/","title":{"rendered":"\u4e3a\u4ec0\u4e48\u70b9\u51fb\u201c\u5f00\u5173\u201d\u6309\u94ae\u6ca1\u6709\u53cd\u5e94\uff1f"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/001\/246\/273\/173130482120416.jpg\" class=\"aligncenter\" title=\"\u4e3a\u4ec0\u4e48\u70b9\u51fb\u201c\u5f00\u5173\u201d\u6309\u94ae\u6ca1\u6709\u53cd\u5e94\uff1f\u63d2\u56fe\" alt=\"\u4e3a\u4ec0\u4e48\u70b9\u51fb\u201c\u5f00\u5173\u201d\u6309\u94ae\u6ca1\u6709\u53cd\u5e94\uff1f\u63d2\u56fe\" \/><\/p>\n<p><strong>\u70b9\u51fb\u201c\u5f00\u5173\u201d\u6309\u94ae\u6ca1\u6709\u53cd\u5e94\uff1f<\/strong><\/p>\n<p>\u4ee5\u4e0b\u4ee3\u7801\u4e2d\u9047\u5230\u70b9\u51fb\u201c\u5f00\u5173\u201d\u6309\u94ae\u4e0d\u54cd\u5e94\u7684\u95ee\u9898\uff1a<\/p>\n<pre>const handleClick = () =&gt; {\n  console.log(123)\n}<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u539f\u56e0\uff1a<\/strong><\/p>\n<p>\u4e0a\u8ff0\u4ee3\u7801\u4e2d\uff0c\u6309\u94ae\u5355\u51fb\u4e8b\u4ef6\u7ed1\u5b9a\u5230\u4e86 handleClick \u51fd\u6570\u4e0a\u3002\u4f46\u662f\uff0c\u63a7\u5236\u53f0\u8f93\u51fa\u8868\u660e\u6ca1\u6709\u4efb\u4f55\u53cd\u5e94\u7684\u539f\u56e0\u53ef\u80fd\u662f\uff1a<\/p>\n<ul>\n<li> <strong>\u4e8b\u4ef6\u540d\u79f0\u9519\u8bef\uff1a<\/strong>\u68c0\u67e5\u6309\u94ae\u7684 onClick \u5c5e\u6027\u662f\u5426\u5df2\u6b63\u786e\u62fc\u5199\u4e3a &#8220;onClick&#8221;\u3002<\/li>\n<li> <strong>\u53d8\u91cf\u540d\u79f0\u9519\u8bef\uff1a<\/strong>\u786e\u4fdd handleClick \u51fd\u6570\u7684\u540d\u79f0\u4e0e\u7ed1\u5b9a\u4e8b\u4ef6\u4e2d\u7684\u540d\u79f0\u76f8\u540c\u3002<\/li>\n<li> <strong>\u5143\u7d20\u88ab\u906e\u76d6\uff1a<\/strong>\u68c0\u67e5\u6309\u94ae\u662f\u5426\u88ab\u5176\u4ed6\u5143\u7d20\u906e\u6321\uff0c\u4ece\u800c\u963b\u6b62\u4e86\u5355\u51fb\u4e8b\u4ef6\u7684\u4f20\u64ad\u3002<\/li>\n<li> <strong>\u63a7\u5236\u53f0\u91cd\u5199\uff1a<\/strong>\u5176\u4ed6\u811a\u672c\u6216\u6d4f\u89c8\u5668\u6269\u5c55\u7a0b\u5e8f\u53ef\u80fd\u5df2\u91cd\u5199\u4e86 console.log \u65b9\u6cd5\uff0c\u4ece\u800c\u963b\u6b62\u4e86\u8f93\u51fa\u3002<\/li>\n<\/ul>\n<p><strong>\u89e3\u51b3\u65b9\u6cd5\uff1a<\/strong><\/p>\n<p>\u6392\u9664\u4e0a\u8ff0\u539f\u56e0\u5e76\u786e\u4fdd\u4ee3\u7801\u6b63\u786e\u65e0\u8bef\u540e\uff0c\u8bf7\u5c1d\u8bd5\u4ee5\u4e0b\u64cd\u4f5c\uff1a<\/p>\n<ul>\n<li>\u5728\u63a7\u5236\u53f0\u4e2d\u67e5\u770b\u662f\u5426\u5b58\u5728\u4efb\u4f55\u9519\u8bef\u6d88\u606f\u6216\u8b66\u544a\u3002<\/li>\n<li>\u68c0\u67e5\u6d4f\u89c8\u5668\u4e2d\u7684\u4e8b\u4ef6\u4fa6\u542c\u5668\u9762\u677f\uff0c\u4ee5\u786e\u8ba4\u5355\u51fb\u4e8b\u4ef6\u662f\u5426\u5df2\u6b63\u786e\u7ed1\u5b9a\u5230\u6309\u94ae\u3002<\/li>\n<li>\u5220\u9664\u4efb\u4f55\u53ef\u80fd\u5e72\u6270\u4e8b\u4ef6\u5904\u7406\u7684\u5176\u4ed6\u811a\u672c\u6216\u6269\u5c55\u7a0b\u5e8f\u3002<\/li>\n<\/ul>\n<p><strong>\u5982\u4f55\u8ba9\u533a\u57df 1 \u5c45\u4e2d\uff1f<\/strong><\/p>\n<p>\u82e5\u8981\u8ba9\u5305\u542b\u5185\u5bb9\u201c\u533a\u57df 1\u201d\u7684 <span> \u5143\u7d20\u5728\u6c34\u5e73\u65b9\u5411\u4e0a\u5c45\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528 margin: 0 auto; \u6837\u5f0f\uff1a<\/span><\/p>\n<pre>span {\n  margin: 0 auto;\n}<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u70b9\u51fb\u201c\u5f00\u5173\u201d\u6309\u94ae\u6ca1\u6709\u53cd\u5e94\uff1f\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>\u70b9\u51fb\u201c\u5f00\u5173\u201d\u6309\u94ae\u6ca1\u6709\u53cd\u5e94\uff1f \u4ee5\u4e0b\u4ee3\u7801\u4e2d\u9047\u5230\u70b9\u51fb\u201c\u5f00\u5173\u201d\u6309\u94ae\u4e0d\u54cd\u5e94\u7684\u95ee\u9898\uff1a const handleClick = () =&gt; { console.log(123) } \u767b\u5f55\u540e\u590d\u5236 \u539f\u56e0\uff1a \u4e0a\u8ff0\u4ee3\u7801\u4e2d\uff0c\u6309\u94ae\u5355\u51fb\u4e8b\u4ef6\u7ed1\u5b9a\u5230\u4e86 handleClick \u51fd\u6570\u4e0a\u3002\u4f46\u662f\uff0c\u63a7\u5236\u53f0\u8f93\u51fa\u8868\u660e\u6ca1\u6709\u4efb\u4f55\u53cd\u5e94\u7684\u539f\u56e0\u53ef\u80fd\u662f\uff1a \u4e8b\u4ef6\u540d\u79f0\u9519\u8bef\uff1a\u68c0\u67e5\u6309\u94ae\u7684 onClick \u5c5e\u6027\u662f\u5426\u5df2\u6b63\u786e\u62fc\u5199\u4e3a &#8220;onClick&#8221;\u3002 \u53d8\u91cf\u540d\u79f0\u9519\u8bef\uff1a\u786e\u4fdd handleClick \u51fd\u6570\u7684\u540d\u79f0\u4e0e\u7ed1\u5b9a\u4e8b\u4ef6\u4e2d\u7684\u540d\u79f0\u76f8\u540c\u3002 \u5143\u7d20\u88ab\u906e\u76d6\uff1a\u68c0\u67e5\u6309\u94ae\u662f\u5426\u88ab\u5176\u4ed6\u5143\u7d20\u906e\u6321\uff0c\u4ece\u800c\u963b\u6b62\u4e86\u5355\u51fb\u4e8b\u4ef6\u7684\u4f20\u64ad\u3002 \u63a7\u5236\u53f0\u91cd\u5199\uff1a\u5176\u4ed6\u811a\u672c\u6216\u6d4f\u89c8\u5668\u6269\u5c55\u7a0b\u5e8f\u53ef\u80fd\u5df2\u91cd\u5199\u4e86 console.log \u65b9\u6cd5\uff0c\u4ece\u800c\u963b\u6b62\u4e86\u8f93\u51fa\u3002 \u89e3\u51b3\u65b9\u6cd5\uff1a \u6392\u9664\u4e0a\u8ff0\u539f\u56e0\u5e76\u786e\u4fdd\u4ee3\u7801\u6b63\u786e\u65e0\u8bef\u540e\uff0c\u8bf7\u5c1d\u8bd5\u4ee5\u4e0b\u64cd\u4f5c\uff1a \u5728\u63a7\u5236\u53f0\u4e2d\u67e5\u770b\u662f\u5426\u5b58\u5728\u4efb\u4f55\u9519\u8bef\u6d88\u606f\u6216\u8b66\u544a\u3002 \u68c0\u67e5\u6d4f\u89c8\u5668\u4e2d\u7684\u4e8b\u4ef6\u4fa6\u542c\u5668\u9762\u677f\uff0c\u4ee5\u786e\u8ba4\u5355\u51fb\u4e8b\u4ef6\u662f\u5426\u5df2\u6b63\u786e\u7ed1\u5b9a\u5230\u6309\u94ae\u3002 \u5220\u9664\u4efb\u4f55\u53ef\u80fd\u5e72\u6270\u4e8b\u4ef6\u5904\u7406\u7684\u5176\u4ed6\u811a\u672c\u6216\u6269\u5c55\u7a0b\u5e8f\u3002 \u5982\u4f55\u8ba9\u533a\u57df 1 \u5c45\u4e2d\uff1f \u82e5\u8981\u8ba9\u5305\u542b\u5185\u5bb9\u201c\u533a\u57df 1\u201d\u7684 \u5143\u7d20\u5728\u6c34\u5e73\u65b9\u5411\u4e0a\u5c45\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528 margin: 0 auto; \u6837\u5f0f\uff1a span { margin: 0 auto; } \u767b\u5f55\u540e\u590d\u5236 \u4ee5\u4e0a\u5c31\u662f\u70b9\u51fb\u201c\u5f00\u5173\u201d\u6309\u94ae\u6ca1\u6709\u53cd\u5e94\uff1f\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-27681","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/27681","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=27681"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/27681\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=27681"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=27681"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=27681"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}