{"id":1790,"date":"2024-11-10T13:54:10","date_gmt":"2024-11-10T05:54:10","guid":{"rendered":"https:\/\/fwq.ai\/blog\/1790\/"},"modified":"2024-11-10T13:54:10","modified_gmt":"2024-11-10T05:54:10","slug":"%e7%bd%91%e7%ab%99%e5%ba%95%e9%83%a8%e5%a6%82%e4%bd%95%e5%ae%9e%e7%8e%b0%e9%a3%98%e5%bd%a9%e5%b8%a6%e6%95%88%e6%9e%9c%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/1790\/","title":{"rendered":"\u7f51\u7ad9\u5e95\u90e8\u5982\u4f55\u5b9e\u73b0\u98d8\u5f69\u5e26\u6548\u679c\uff1f"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/001\/246\/273\/173059277993884.jpg\" class=\"aligncenter\" title=\"\u7f51\u7ad9\u5e95\u90e8\u5982\u4f55\u5b9e\u73b0\u98d8\u5f69\u5e26\u6548\u679c\uff1f\u63d2\u56fe\" alt=\"\u7f51\u7ad9\u5e95\u90e8\u5982\u4f55\u5b9e\u73b0\u98d8\u5f69\u5e26\u6548\u679c\uff1f\u63d2\u56fe\" \/><\/p>\n<p><strong>\u7f51\u7ad9\u5e95\u90e8\u98d8\u5f69\u5e26\u6548\u679c\u7684 js \u5e93\u5b9e\u73b0<\/strong><\/p>\n<p>\u8bb8\u591a\u7f51\u7ad9\u90fd\u4f1a\u5728\u7279\u6b8a\u8282\u65e5\u6216\u6d3b\u52a8\u4e2d\u6dfb\u52a0\u4e00\u4e9b\u8da3\u5473\u6027\u7684\u89c6\u89c9\u6548\u679c\uff0c\u4f8b\u5982\u70b9\u51fb\u6309\u94ae\u540e\u6563\u53d1\u7684\u4e94\u5f69\u7f24\u7eb7\u7684\u5f69\u5e26\u3002\u5bf9\u4e8e\u4e00\u4e2a\u7279\u5b9a\u7684\u7f51\u7ad9\u6765\u8bf4\uff0c\u5176\u98d8\u5f69\u5e26\u6548\u679c\u7684\u5b9e\u73b0\u65b9\u5f0f\u53ef\u80fd\u6709\u4ee5\u4e0b\u51e0\u4e2a\u65b9\u9762\uff1a<\/p>\n<p>\u4ee5 https:\/\/dub.sh\/ \u7f51\u7ad9\u4e3a\u4f8b\uff0c\u5b83\u5e95\u90e8\u6309\u94ae\u70b9\u51fb\u540e\u7684\u5f69\u5e26\u6548\u679c\u662f\u7531 javascript \u5e93\u5b9e\u73b0\u7684\u3002\u5177\u4f53\u91c7\u7528\u7684\u5e93\u5982\u4e0b\uff1a<\/p>\n<ul>\n<li> <strong>confetti.js<\/strong> (https:\/\/hub.com\/shinnn\/confetti-js)<\/li>\n<li> <strong>canvas confetti<\/strong> (https:\/\/www.kirilv.com\/canvas-confetti\/)<\/li>\n<\/ul>\n<p>\u8fd9\u4e24\u79cd\u5e93\u90fd\u63d0\u4f9b\u4e86\u751f\u6210\u548c\u52a8\u753b\u5316\u5f69\u5e26\u6548\u679c\u7684\u65b9\u6cd5\u3002\u4ee5\u4e0b\u662f\u5982\u4f55\u4f7f\u7528\u5b83\u4eec\u4e4b\u4e00\uff08\u4f8b\u5982 confetti.js\uff09\u5728\u4f60\u7684\u7f51\u7ad9\u4e2d\u5b9e\u73b0\u7c7b\u4f3c\u6548\u679c\u7684\u793a\u4f8b\u4ee3\u7801\uff1a<\/p>\n<pre>&lt;script src=\"https:\/\/cdn.jsdelivr.net\/npm\/confetti-js@1.4.0\/dist\/confetti.browser.min.js\"&gt;&lt;\/script&gt;\n&lt;script&gt;\n  window.onload = function() {\n    let confetti = new Confetti();\n    document.getElementById('button').addEventListener('click', function() {\n      confetti.start();\n    });\n  };\n&lt;\/script&gt;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u5728\u8fd9\u4e2a\u793a\u4f8b\u4e2d\uff0cconfetti.js \u5e93\u901a\u8fc7\u5305\u542b\u5176\u811a\u672c\u6587\u4ef6\u52a0\u8f7d\u5230\u9875\u9762\u4e2d\u3002\u5f53\u9875\u9762\u52a0\u8f7d\u5b8c\u6210\u540e\uff0c\u4e00\u4e2a\u65b0\u7684 confetti \u5b9e\u4f8b\u88ab\u521b\u5efa\u5e76\u5b58\u50a8\u5728 confetti \u53d8\u91cf\u4e2d\u3002\u5f53\u7528\u6237\u70b9\u51fb\u5177\u6709 id \u4e3a button \u7684\u5143\u7d20\u65f6\uff0cstart() \u65b9\u6cd5\u88ab\u8c03\u7528\uff0c\u5f00\u59cb\u663e\u793a\u5f69\u5e26\u6548\u679c\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u7f51\u7ad9\u5e95\u90e8\u5982\u4f55\u5b9e\u73b0\u98d8\u5f69\u5e26\u6548\u679c\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>\u7f51\u7ad9\u5e95\u90e8\u98d8\u5f69\u5e26\u6548\u679c\u7684 js \u5e93\u5b9e\u73b0 \u8bb8\u591a\u7f51\u7ad9\u90fd\u4f1a\u5728\u7279\u6b8a\u8282\u65e5\u6216\u6d3b\u52a8\u4e2d\u6dfb\u52a0\u4e00\u4e9b\u8da3\u5473\u6027\u7684\u89c6\u89c9\u6548\u679c\uff0c\u4f8b\u5982\u70b9\u51fb\u6309\u94ae\u540e\u6563\u53d1\u7684\u4e94\u5f69\u7f24\u7eb7\u7684\u5f69\u5e26\u3002\u5bf9\u4e8e\u4e00\u4e2a\u7279\u5b9a\u7684\u7f51\u7ad9\u6765\u8bf4\uff0c\u5176\u98d8\u5f69\u5e26\u6548\u679c\u7684\u5b9e\u73b0\u65b9\u5f0f\u53ef\u80fd\u6709\u4ee5\u4e0b\u51e0\u4e2a\u65b9\u9762\uff1a \u4ee5 https:\/\/dub.sh\/ \u7f51\u7ad9\u4e3a\u4f8b\uff0c\u5b83\u5e95\u90e8\u6309\u94ae\u70b9\u51fb\u540e\u7684\u5f69\u5e26\u6548\u679c\u662f\u7531 javascript \u5e93\u5b9e\u73b0\u7684\u3002\u5177\u4f53\u91c7\u7528\u7684\u5e93\u5982\u4e0b\uff1a confetti.js (https:\/\/hub.com\/shinnn\/confetti-js) canvas confetti (https:\/\/www.kirilv.com\/canvas-confetti\/) \u8fd9\u4e24\u79cd\u5e93\u90fd\u63d0\u4f9b\u4e86\u751f\u6210\u548c\u52a8\u753b\u5316\u5f69\u5e26\u6548\u679c\u7684\u65b9\u6cd5\u3002\u4ee5\u4e0b\u662f\u5982\u4f55\u4f7f\u7528\u5b83\u4eec\u4e4b\u4e00\uff08\u4f8b\u5982 confetti.js\uff09\u5728\u4f60\u7684\u7f51\u7ad9\u4e2d\u5b9e\u73b0\u7c7b\u4f3c\u6548\u679c\u7684\u793a\u4f8b\u4ee3\u7801\uff1a &lt;script src=&#8221;https:\/\/cdn.jsdelivr.net\/npm\/confetti-js@1.4.0\/dist\/confetti.browser.min.js&#8221;&gt;&lt;\/script&gt; &lt;script&gt; window.onload = function() { let confetti = new Confetti(); document.getElementById(&#8216;button&#8217;).addEventListener(&#8216;click&#8217;, function() { confetti.start(); }); }; &lt;\/script&gt; \u767b\u5f55\u540e\u590d\u5236 \u5728\u8fd9\u4e2a\u793a\u4f8b\u4e2d\uff0cconfetti.js \u5e93\u901a\u8fc7\u5305\u542b\u5176\u811a\u672c\u6587\u4ef6\u52a0\u8f7d\u5230\u9875\u9762\u4e2d\u3002\u5f53\u9875\u9762\u52a0\u8f7d\u5b8c\u6210\u540e\uff0c\u4e00\u4e2a\u65b0\u7684 confetti \u5b9e\u4f8b\u88ab\u521b\u5efa\u5e76\u5b58\u50a8\u5728 confetti \u53d8\u91cf\u4e2d\u3002\u5f53\u7528\u6237\u70b9\u51fb\u5177\u6709 id \u4e3a button \u7684\u5143\u7d20\u65f6\uff0cstart() \u65b9\u6cd5\u88ab\u8c03\u7528\uff0c\u5f00\u59cb\u663e\u793a\u5f69\u5e26\u6548\u679c\u3002 \u4ee5\u4e0a\u5c31\u662f\u7f51\u7ad9\u5e95\u90e8\u5982\u4f55\u5b9e\u73b0\u98d8\u5f69\u5e26\u6548\u679c\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-1790","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/1790","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=1790"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/1790\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=1790"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=1790"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=1790"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}