{"id":5613,"date":"2023-01-06T10:04:47","date_gmt":"2023-01-06T02:04:47","guid":{"rendered":"https:\/\/badgameshow.com\/steven\/?p=5613"},"modified":"2023-01-06T10:04:47","modified_gmt":"2023-01-06T02:04:47","slug":"1-%e4%ba%86%e8%a7%a3%e5%a6%82%e4%bd%95%e5%88%a9%e7%94%a8react-js%e4%be%86%e7%a2%ba%e4%bf%9d%e7%ba%a6%e5%ae%9a%e5%ad%97%e7%ac%a6%e4%b8%b2isconventioncase","status":"publish","type":"post","link":"https:\/\/badgameshow.com\/steven\/react-js\/1-%e4%ba%86%e8%a7%a3%e5%a6%82%e4%bd%95%e5%88%a9%e7%94%a8react-js%e4%be%86%e7%a2%ba%e4%bf%9d%e7%ba%a6%e5%ae%9a%e5%ad%97%e7%ac%a6%e4%b8%b2isconventioncase\/","title":{"rendered":"1.\u4e86\u89e3\u5982\u4f55\u5229\u7528React.JS\u4f86\u78ba\u4fdd\u7ea6\u5b9a\u5b57\u7b26\u4e32(isConventionCase)"},"content":{"rendered":"<p><meta name=\"keywords\" content=\"React.JS, isConventionCase\"><\/p>\n<p>React.JS \u662f\u4e00\u500b\u7531 Facebook \u6240\u958b\u767c\u7684 JavaScript \u51fd\u5f0f\u5eab\uff0c\u5b83\u53ef\u4ee5\u8b93\u958b\u767c\u8005\u5efa\u7acb\u51fa\u9ad8\u6548\u7387\u7684\u7db2\u9801\u61c9\u7528\u7a0b\u5f0f\u3002\u672c\u6587\u5c07\u8a0e\u8ad6\u5982\u4f55\u4f7f\u7528 React.JS \u4f86\u6c42\u51fa\u662f\u5426\u70ba\u7ea6\u5b9a\u5b57\u7b26\u4e32 (isConventionCase)\u3002<\/p>\n<p>React.JS \u63d0\u4f9b\u4e86\u4e00\u500b\u975e\u5e38\u6709\u7528\u7684 API\uff0c\u53ef\u4ee5\u8b93\u958b\u767c\u8005\u66f4\u5bb9\u6613\u5730\u6c42\u51fa\u662f\u5426\u70ba\u7ea6\u5b9a\u5b57\u7b26\u4e32 (isConventionCase)\u3002\u9019\u500b API \u53ef\u4ee5\u8b93\u958b\u767c\u8005\u66f4\u5bb9\u6613\u5730\u6aa2\u67e5\u5b57\u4e32\u662f\u5426\u7b26\u5408\u7ea6\u5b9a\u7684\u683c\u5f0f\uff0c\u4f8b\u5982\uff1a<\/p>\n<pre class=\"brush: javascript\">\nconst isConventionCase = (str) => {\n  const regex = \/^[A-Z][a-z]+([A-Z][a-z]+)+$\/;\n  return regex.test(str);\n};\n<\/pre>\n<p>\u4e0a\u9762\u7684\u7a0b\u5f0f\u78bc\u53ef\u4ee5\u7528\u4f86\u6aa2\u67e5\u5b57\u4e32\u662f\u5426\u7b26\u5408\u7ea6\u5b9a\u7684\u683c\u5f0f\uff0c\u4f8b\u5982\uff1a<\/p>\n<pre class=\"brush: javascript\">\nisConventionCase('ReactJS'); \/\/ true\nisConventionCase('reactjs'); \/\/ false\n<\/pre>\n<p>\u4f7f\u7528 React.JS \u4f86\u6c42\u51fa\u662f\u5426\u70ba\u7ea6\u5b9a\u5b57\u7b26\u4e32 (isConventionCase) \u662f\u4e00\u500b\u975e\u5e38\u6709\u7528\u7684\u529f\u80fd\uff0c\u5b83\u53ef\u4ee5\u8b93\u958b\u767c\u8005\u66f4\u5bb9\u6613\u5730\u6aa2\u67e5\u5b57\u4e32\u662f\u5426\u7b26\u5408\u7ea6\u5b9a\u7684\u683c\u5f0f\uff0c\u4e26\u4e14\u53ef\u4ee5\u66f4\u5feb\u901f\u5730\u6c42\u51fa\u7d50\u679c\u3002<\/p>\n<p><!--more--><\/p>\n<p>\u6b64\u5916\uff0cReact.JS \u9084\u63d0\u4f9b\u4e86\u4e00\u500b\u975e\u5e38\u6709\u7528\u7684 API\uff0c\u53ef\u4ee5\u8b93\u958b\u767c\u8005\u66f4\u5bb9\u6613\u5730\u6c42\u51fa\u662f\u5426\u70ba\u7ea6\u5b9a\u5b57\u7b26\u4e32 (isConventionCase) \u7684\u7d50\u679c\u3002\u9019\u500b API \u53ef\u4ee5\u8b93\u958b\u767c\u8005\u66f4\u5bb9\u6613\u5730\u6aa2\u67e5\u5b57\u4e32\u662f\u5426\u7b26\u5408\u7ea6\u5b9a\u7684\u683c\u5f0f\uff0c\u4e26\u4e14\u53ef\u4ee5\u66f4\u5feb\u901f\u5730\u6c42\u51fa\u7d50\u679c\u3002<\/p>\n<p>\u4f7f\u7528 React.JS \u4f86\u6c42\u51fa\u662f\u5426\u70ba\u7ea6\u5b9a\u5b57\u7b26\u4e32 (isConventionCase) \u662f\u4e00\u500b\u975e\u5e38\u6709\u7528\u7684\u529f\u80fd\uff0c\u5b83\u53ef\u4ee5\u8b93\u958b\u767c\u8005\u66f4\u5bb9\u6613\u5730\u6aa2\u67e5\u5b57\u4e32\u662f\u5426\u7b26\u5408\u7ea6\u5b9a\u7684\u683c\u5f0f\uff0c\u4e26\u4e14\u53ef\u4ee5\u66f4\u5feb\u901f\u5730\u6c42\u51fa\u7d50\u679c\u3002\u56e0\u6b64\uff0c\u4f7f\u7528 React.JS \u4f86\u6c42\u51fa\u662f\u5426\u70ba\u7ea6\u5b9a\u5b57\u7b26\u4e32 (isConventionCase) \u662f\u4e00\u500b\u975e\u5e38\u6709\u7528\u7684\u529f\u80fd\uff0c\u53ef\u4ee5\u8b93\u958b\u767c\u8005\u66f4\u5bb9\u6613\u5730\u6aa2\u67e5\u5b57\u4e32\u662f\u5426\u7b26\u5408\u7ea6\u5b9a\u7684\u683c\u5f0f\uff0c\u4e26\u4e14\u53ef\u4ee5\u66f4\u5feb\u901f\u5730\u6c42\u51fa\u7d50\u679c\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>2.\u672c\u6587\u5c07\u4ecb\u7d39\u5982\u4f55\u4f7f\u7528React.JS\u4f86\u78ba\u4fdd\u7ea6\u5b9a\u5b57\u7b26\u4e32(isConventionCase)\uff0c\u4e26\u63d0\u4f9b\u4e00\u4e9b\u6709\u7528\u7684\u6280\u5de7\uff0c\u4ee5\u4fbf\u958b\u767c\u8005\u80fd\u5920\u66f4\u6709\u6548\u5730\u4f7f\u7528React.JS\u4f86\u78ba\u4fdd\u7ea6\u5b9a\u5b57\u7b26\u4e32(isConventionCase)\u3002<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[184,183],"tags":[182,181],"class_list":["post-5613","post","type-post","status-publish","format-standard","hentry","category-react","category-react-js","tag-react","tag-react-js"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack-related-posts":[],"jetpack_shortlink":"https:\/\/wp.me\/pcFK27-1sx","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/posts\/5613","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/comments?post=5613"}],"version-history":[{"count":1,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/posts\/5613\/revisions"}],"predecessor-version":[{"id":5614,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/posts\/5613\/revisions\/5614"}],"wp:attachment":[{"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/media?parent=5613"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/categories?post=5613"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/tags?post=5613"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}