{"id":4109,"date":"2024-11-10T08:46:54","date_gmt":"2024-11-10T00:46:54","guid":{"rendered":"https:\/\/fwq.ai\/blog\/4109\/"},"modified":"2024-11-10T08:46:54","modified_gmt":"2024-11-10T00:46:54","slug":"javascript-%e5%af%b9%e8%b1%a1%e6%b7%bb%e5%8a%a0%e5%b1%9e%e6%80%a7%e5%89%8d%e4%b8%ba%e4%bd%95%e8%83%bd%e7%9c%8b%e5%88%b0%e8%af%a5%e5%b1%9e%e6%80%a7%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/4109\/","title":{"rendered":"JavaScript \u5bf9\u8c61\u6dfb\u52a0\u5c5e\u6027\u524d\u4e3a\u4f55\u80fd\u770b\u5230\u8be5\u5c5e\u6027\uff1f"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/001\/246\/273\/173122651125960.jpg\" class=\"aligncenter\" title=\"JavaScript \u5bf9\u8c61\u6dfb\u52a0\u5c5e\u6027\u524d\u4e3a\u4f55\u80fd\u770b\u5230\u8be5\u5c5e\u6027\uff1f\u63d2\u56fe\" alt=\"JavaScript \u5bf9\u8c61\u6dfb\u52a0\u5c5e\u6027\u524d\u4e3a\u4f55\u80fd\u770b\u5230\u8be5\u5c5e\u6027\uff1f\u63d2\u56fe\" \/><\/p>\n<p><strong>\u5728 javascript \u4e2d\uff0c\u5bf9\u8c61\u6dfb\u52a0\u5c5e\u6027\u524d\u4e3a\u4f55\u80fd\u770b\u5230\u8be5\u5c5e\u6027\uff1f<\/strong><\/p>\n<p>\u5f53\u521b\u5efa\u4e00\u4e2a javascript \u5bf9\u8c61\u65f6\uff0c\u5373\u4f7f\u5728\u6dfb\u52a0\u5c5e\u6027\u4e4b\u524d\uff0c\u4e5f\u53ef\u4ee5\u901a\u8fc7\u70b9\u8bed\u6cd5\u6216\u65b9\u62ec\u53f7\u8bed\u6cd5\u8bbf\u95ee\u8be5\u5c5e\u6027\u3002\u8fd9\u662f\u56e0\u4e3a\uff1a<\/p>\n<p>\u88ab\u8f93\u51fa\u7684\u5b9e\u9645\u4e0a\u662f\u5bf9\u8c61\u672c\u8eab\uff0c\u800c\u4e0d\u662f\u5bf9\u8c61\u5728\u8f93\u51fa\u65f6\u7684\u72b6\u6001\u3002\u56e0\u6b64\uff0c\u5bf9\u8c61\u540e\u7eed\u53d1\u751f\u7684\u4efb\u4f55\u66f4\u6539\u90fd\u4f1a\u53cd\u6620\u5728\u8f93\u51fa\u7ed3\u679c\u4e2d\u3002<\/p>\n<p>\u4ee5\u4e0b\u4ee3\u7801\u6f14\u793a\u4e86\u8fd9\u4e00\u70b9\uff1a<\/p>\n<p><span>\u7acb\u5373\u5b66\u4e60<\/span>\u201c\u201d\uff1b<\/p>\n<pre>let checkedinput = {};\nconsole.log(checkedinput);\ncheckedinput.addressnum = [\/^.{5,20}$\/, '\u5730\u5740\u5fc5\u987b\u5927\u4e8e\u7b49\u4e8e5\u4e2a\u5b57'];<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u8f93\u51fa\u5c06\u663e\u793a\u4e00\u4e2a\u5305\u542b addressnum \u5c5e\u6027\u7684\u5bf9\u8c61\uff0c\u5373\u4f7f\u8be5\u5c5e\u6027\u662f\u5728\u8f93\u51fa\u4e4b\u540e\u6dfb\u52a0\u7684\u3002<\/p>\n<p><strong>\u89e3\u51b3\u65b9\u6cd5\uff1a<\/strong><\/p>\n<p>\u5982\u679c\u60a8\u5e0c\u671b\u8f93\u51fa\u5bf9\u8c61\u5728\u7279\u5b9a\u65f6\u95f4\u70b9\u7684\u72b6\u6001\uff0c\u53ef\u4ee5\u5148\u5c06\u5bf9\u8c61\u8f6c\u6362\u4e3a\u5b57\u7b26\u4e32\uff0c\u7136\u540e\u8f93\u51fa\u5b57\u7b26\u4e32\uff1a<\/p>\n<pre>let checkedInput = {};\nconsole.log(JSON.stringify(checkedInput));\ncheckedInput.addressNum = [\/^.{5,20}$\/, '\u5730\u5740\u5fc5\u987b\u5927\u4e8e\u7b49\u4e8e5\u4e2a\u5b57'];<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u4ee5\u4e0a\u5c31\u662fJavaScript \u5bf9\u8c61\u6dfb\u52a0\u5c5e\u6027\u524d\u4e3a\u4f55\u80fd\u770b\u5230\u8be5\u5c5e\u6027\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>\u5728 javascript \u4e2d\uff0c\u5bf9\u8c61\u6dfb\u52a0\u5c5e\u6027\u524d\u4e3a\u4f55\u80fd\u770b\u5230\u8be5\u5c5e\u6027\uff1f \u5f53\u521b\u5efa\u4e00\u4e2a javascript \u5bf9\u8c61\u65f6\uff0c\u5373\u4f7f\u5728\u6dfb\u52a0\u5c5e\u6027\u4e4b\u524d\uff0c\u4e5f\u53ef\u4ee5\u901a\u8fc7\u70b9\u8bed\u6cd5\u6216\u65b9\u62ec\u53f7\u8bed\u6cd5\u8bbf\u95ee\u8be5\u5c5e\u6027\u3002\u8fd9\u662f\u56e0\u4e3a\uff1a \u88ab\u8f93\u51fa\u7684\u5b9e\u9645\u4e0a\u662f\u5bf9\u8c61\u672c\u8eab\uff0c\u800c\u4e0d\u662f\u5bf9\u8c61\u5728\u8f93\u51fa\u65f6\u7684\u72b6\u6001\u3002\u56e0\u6b64\uff0c\u5bf9\u8c61\u540e\u7eed\u53d1\u751f\u7684\u4efb\u4f55\u66f4\u6539\u90fd\u4f1a\u53cd\u6620\u5728\u8f93\u51fa\u7ed3\u679c\u4e2d\u3002 \u4ee5\u4e0b\u4ee3\u7801\u6f14\u793a\u4e86\u8fd9\u4e00\u70b9\uff1a \u7acb\u5373\u5b66\u4e60\u201c\u201d\uff1b let checkedinput = {}; console.log(checkedinput); checkedinput.addressnum = [\/^.{5,20}$\/, &#8216;\u5730\u5740\u5fc5\u987b\u5927\u4e8e\u7b49\u4e8e5\u4e2a\u5b57&#8217;]; \u767b\u5f55\u540e\u590d\u5236 \u8f93\u51fa\u5c06\u663e\u793a\u4e00\u4e2a\u5305\u542b addressnum \u5c5e\u6027\u7684\u5bf9\u8c61\uff0c\u5373\u4f7f\u8be5\u5c5e\u6027\u662f\u5728\u8f93\u51fa\u4e4b\u540e\u6dfb\u52a0\u7684\u3002 \u89e3\u51b3\u65b9\u6cd5\uff1a \u5982\u679c\u60a8\u5e0c\u671b\u8f93\u51fa\u5bf9\u8c61\u5728\u7279\u5b9a\u65f6\u95f4\u70b9\u7684\u72b6\u6001\uff0c\u53ef\u4ee5\u5148\u5c06\u5bf9\u8c61\u8f6c\u6362\u4e3a\u5b57\u7b26\u4e32\uff0c\u7136\u540e\u8f93\u51fa\u5b57\u7b26\u4e32\uff1a let checkedInput = {}; console.log(JSON.stringify(checkedInput)); checkedInput.addressNum = [\/^.{5,20}$\/, &#8216;\u5730\u5740\u5fc5\u987b\u5927\u4e8e\u7b49\u4e8e5\u4e2a\u5b57&#8217;]; \u767b\u5f55\u540e\u590d\u5236 \u4ee5\u4e0a\u5c31\u662fJavaScript \u5bf9\u8c61\u6dfb\u52a0\u5c5e\u6027\u524d\u4e3a\u4f55\u80fd\u770b\u5230\u8be5\u5c5e\u6027\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-4109","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/4109","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=4109"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/4109\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=4109"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=4109"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=4109"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}