{"id":27387,"date":"2024-11-24T16:25:46","date_gmt":"2024-11-24T08:25:46","guid":{"rendered":"https:\/\/fwq.ai\/blog\/27387\/"},"modified":"2024-11-24T16:25:46","modified_gmt":"2024-11-24T08:25:46","slug":"%e5%a6%82%e4%bd%95%e5%ae%9e%e7%8e%b0%e4%b8%80%e4%b8%aa%e5%8f%aa%e8%83%bd%e8%be%93%e5%85%a5%e7%ba%af%e6%95%b0%e5%ad%97%e3%80%81%e8%87%aa%e5%8a%a8%e6%8d%a2%e8%a1%8c%e5%b9%b6%e5%8e%bb%e6%8e%89%e5%b0%be","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/27387\/","title":{"rendered":"\u5982\u4f55\u5b9e\u73b0\u4e00\u4e2a\u53ea\u80fd\u8f93\u5165\u7eaf\u6570\u5b57\u3001\u81ea\u52a8\u6362\u884c\u5e76\u53bb\u6389\u5c3e\u65700\u7684HTML Number\u533a\u57df\uff1f"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/001\/246\/273\/173123874469671.jpg\" class=\"aligncenter\" title=\"\u5982\u4f55\u5b9e\u73b0\u4e00\u4e2a\u53ea\u80fd\u8f93\u5165\u7eaf\u6570\u5b57\u3001\u81ea\u52a8\u6362\u884c\u5e76\u53bb\u6389\u5c3e\u65700\u7684HTML Number\u533a\u57df\uff1f\u63d2\u56fe\" alt=\"\u5982\u4f55\u5b9e\u73b0\u4e00\u4e2a\u53ea\u80fd\u8f93\u5165\u7eaf\u6570\u5b57\u3001\u81ea\u52a8\u6362\u884c\u5e76\u53bb\u6389\u5c3e\u65700\u7684HTML Number\u533a\u57df\uff1f\u63d2\u56fe\" \/><\/p>\n<p><strong>html\u4e2d\u4f7f\u7528\u81ea\u52a8\u6362\u884c\u548c\u53bb\u6389\u5c3e\u65700\u6570\u5b57\u533a\u57df<\/strong><\/p>\n<p>\u8981\u5b9e\u73b0\u4e00\u4e2a\u53ea\u80fd\u8f93\u5165\u7eaf\u6570\u5b57\u3001\u652f\u6301\u81ea\u52a8\u6362\u884c\u5e76\u53bb\u6389\u5c3e\u65700\u7684HTML Number\u533a\u57df\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u65b9\u6cd5\uff1a<\/p>\n<p><strong>\u4f7f\u7528Textarea\u5143\u7d20\u548c\u81ea\u5b9a\u4e49\u4e8b\u4ef6\u5904\u7406\u7a0b\u5e8f<\/strong><\/p>\n<ol>\n<li>\u4f7f\u7528  \u5143\u7d20\u4f5c\u4e3a\u8f93\u5165\u533a\u57df\u3002 <\/li>\n<li>\u6dfb\u52a0 @keyup \u4e8b\u4ef6\u5904\u7406\u7a0b\u5e8f\uff0c\u4ee5\u68c0\u6d4b\u952e\u5165\u4e8b\u4ef6\u3002<\/li>\n<li>\u5728\u4e8b\u4ef6\u5904\u7406\u7a0b\u5e8f\u4e2d\uff0c\u4f7f\u7528\u6b63\u5219\u8868\u8fbe\u5f0f\u66ff\u6362\u975e\u6570\u5b57\u5b57\u7b26\u548c\u91cd\u590d\u7684\u5c0f\u6570\u70b9\u3002<\/li>\n<li>\u4f7f\u7528 match() \u65b9\u6cd5\u5c06\u8f93\u5165\u5206\u62106\u4e2a\u5b57\u7b26\u4e00\u7ec4\uff0c\u5e76\u7528\u6362\u884c\u7b26 \u5c06\u5176\u8fde\u63a5\u8d77\u6765\u3002<\/li>\n<li>\u5c06\u5904\u7406\u540e\u7684\u503c\u5206\u914d\u7ed9 textarea \u7684 v-model \u7ed1\u5b9a\uff0c\u4ee5\u8fdb\u884c\u663e\u793a\u3002<\/li>\n<\/ol>\n<p><strong>Example<\/strong><\/p>\n<pre>&lt;script setup&gt;\nimport { ref } from \"vue\";\n\nconst textarea_number_data = ref();\nconst textarea_number = ref();\nconst keyupNumber = () =&gt; {\n  textarea_number_data.value = textarea_number_data.match(\/.{1,6}\/g).join(\"\n\");\n};\n&lt;\/script&gt;\n\n&lt;template&gt;\n  &lt;textarea v-model=\"textarea_number\" @keyup=\"keyupNumber\"&gt;&lt;\/textarea&gt;\n&lt;\/template&gt;<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u5982\u4f55\u5b9e\u73b0\u4e00\u4e2a\u53ea\u80fd\u8f93\u5165\u7eaf\u6570\u5b57\u3001\u81ea\u52a8\u6362\u884c\u5e76\u53bb\u6389\u5c3e\u65700\u7684HTML Number\u533a\u57df\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>html\u4e2d\u4f7f\u7528\u81ea\u52a8\u6362\u884c\u548c\u53bb\u6389\u5c3e\u65700\u6570\u5b57\u533a\u57df \u8981\u5b9e\u73b0\u4e00\u4e2a\u53ea\u80fd\u8f93\u5165\u7eaf\u6570\u5b57\u3001\u652f\u6301\u81ea\u52a8\u6362\u884c\u5e76\u53bb\u6389\u5c3e\u65700\u7684HTML Number\u533a\u57df\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u65b9\u6cd5\uff1a \u4f7f\u7528Textarea\u5143\u7d20\u548c\u81ea\u5b9a\u4e49\u4e8b\u4ef6\u5904\u7406\u7a0b\u5e8f \u4f7f\u7528 \u5143\u7d20\u4f5c\u4e3a\u8f93\u5165\u533a\u57df\u3002 \u6dfb\u52a0 @keyup \u4e8b\u4ef6\u5904\u7406\u7a0b\u5e8f\uff0c\u4ee5\u68c0\u6d4b\u952e\u5165\u4e8b\u4ef6\u3002 \u5728\u4e8b\u4ef6\u5904\u7406\u7a0b\u5e8f\u4e2d\uff0c\u4f7f\u7528\u6b63\u5219\u8868\u8fbe\u5f0f\u66ff\u6362\u975e\u6570\u5b57\u5b57\u7b26\u548c\u91cd\u590d\u7684\u5c0f\u6570\u70b9\u3002 \u4f7f\u7528 match() \u65b9\u6cd5\u5c06\u8f93\u5165\u5206\u62106\u4e2a\u5b57\u7b26\u4e00\u7ec4\uff0c\u5e76\u7528\u6362\u884c\u7b26 \u5c06\u5176\u8fde\u63a5\u8d77\u6765\u3002 \u5c06\u5904\u7406\u540e\u7684\u503c\u5206\u914d\u7ed9 textarea \u7684 v-model \u7ed1\u5b9a\uff0c\u4ee5\u8fdb\u884c\u663e\u793a\u3002 Example &lt;script setup&gt; import { ref } from &#8220;vue&#8221;; const textarea_number_data = ref(); const textarea_number = ref(); const keyupNumber = () =&gt; { textarea_number_data.value = textarea_number_data.match(\/.{1,6}\/g).join(&#8221; &#8220;); }; &lt;\/script&gt; &lt;template&gt; &lt;textarea v-model=&#8221;textarea_number&#8221; @keyup=&#8221;keyupNumber&#8221;&gt;&lt;\/textarea&gt; &lt;\/template&gt; \u767b\u5f55\u540e\u590d\u5236 \u4ee5\u4e0a\u5c31\u662f\u5982\u4f55\u5b9e\u73b0\u4e00\u4e2a\u53ea\u80fd\u8f93\u5165\u7eaf\u6570\u5b57\u3001\u81ea\u52a8\u6362\u884c\u5e76\u53bb\u6389\u5c3e\u65700\u7684HTML [&hellip;]<\/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-27387","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/27387","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=27387"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/27387\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=27387"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=27387"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=27387"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}