{"id":6514,"date":"2023-01-08T21:26:36","date_gmt":"2023-01-08T13:26:36","guid":{"rendered":"https:\/\/badgameshow.com\/steven\/?p=6514"},"modified":"2023-01-08T21:26:36","modified_gmt":"2023-01-08T13:26:36","slug":"%e4%bd%bf%e7%94%a8react-js%e5%bf%ab%e9%80%9f%e6%b1%82%e5%8f%96%e5%9b%9b%e8%88%8d%e4%ba%94%e5%85%a5-2","status":"publish","type":"post","link":"https:\/\/badgameshow.com\/steven\/react-js\/%e4%bd%bf%e7%94%a8react-js%e5%bf%ab%e9%80%9f%e6%b1%82%e5%8f%96%e5%9b%9b%e8%88%8d%e4%ba%94%e5%85%a5-2\/","title":{"rendered":"\u4f7f\u7528React.JS\u5feb\u901f\u6c42\u53d6\u56db\u820d\u4e94\u5165"},"content":{"rendered":"<p><meta name=\"keywords\" content=\"React, React List, round\"><\/p>\n<h1>\u4f7f\u7528 React.JS \u5be6\u73fe\u6c42\u56db\u820d\u4e94\u5165(round)<\/h1>\n<p>React.JS \u662f\u4e00\u500b\u7528\u65bc\u69cb\u5efa\u7528\u6236\u754c\u9762\u7684 JavaScript \u5eab\uff0c\u5b83\u53ef\u4ee5\u8b93\u958b\u767c\u8005\u5feb\u901f\u69cb\u5efa\u51fa\u9ad8\u54c1\u8cea\u7684\u7528\u6236\u754c\u9762\u3002\u5728 React.JS \u4e2d\uff0c\u958b\u767c\u8005\u53ef\u4ee5\u4f7f\u7528 React List \u4f86\u5be6\u73fe\u6c42\u56db\u820d\u4e94\u5165(round)\u7684\u529f\u80fd\u3002<\/p>\n<h2>React List \u7684\u6c42\u56db\u820d\u4e94\u5165(round) \u529f\u80fd<\/h2>\n<p>React List \u662f\u4e00\u500b\u7528\u65bc\u69cb\u5efa\u7528\u6236\u754c\u9762\u7684 JavaScript \u5eab\uff0c\u5b83\u53ef\u4ee5\u8b93\u958b\u767c\u8005\u5feb\u901f\u69cb\u5efa\u51fa\u9ad8\u54c1\u8cea\u7684\u7528\u6236\u754c\u9762\u3002React List \u63d0\u4f9b\u4e86\u4e00\u500b round \u65b9\u6cd5\uff0c\u53ef\u4ee5\u7528\u4f86\u5c0d\u6578\u5b57\u9032\u884c\u56db\u820d\u4e94\u5165\u7684\u64cd\u4f5c\u3002<\/p>\n<h2>\u4f7f\u7528 React List \u7684 round \u65b9\u6cd5<\/h2>\n<p>\u4f7f\u7528 React List \u7684 round \u65b9\u6cd5\u53ef\u4ee5\u5f88\u5bb9\u6613\u5730\u5c0d\u6578\u5b57\u9032\u884c\u56db\u820d\u4e94\u5165\u7684\u64cd\u4f5c\u3002\u4e0b\u9762\u662f\u4e00\u500b\u7c21\u55ae\u7684\u793a\u4f8b\uff1a<\/p>\n<pre class=\"brush: javascript\">\nimport React from 'react';\nimport { List } from 'react-list';\n\nconst numbers = [1.5, 2.3, 3.7, 4.9];\n\nconst roundedNumbers = numbers.map(num => List.round(num));\n\nconsole.log(roundedNumbers); \/\/ [2, 2, 4, 5]\n<\/pre>\n<p>\u5728\u4e0a\u9762\u7684\u793a\u4f8b\u4e2d\uff0c\u6211\u5011\u4f7f\u7528\u4e86 React List \u7684 round \u65b9\u6cd5\u5c0d numbers \u6578\u7d44\u4e2d\u7684\u6bcf\u500b\u6578\u5b57\u9032\u884c\u4e86\u56db\u820d\u4e94\u5165\u7684\u64cd\u4f5c\uff0c\u6700\u7d42\u5f97\u5230\u4e86 roundedNumbers \u6578\u7d44\uff0c\u5176\u4e2d\u7684\u6bcf\u500b\u6578\u5b57\u90fd\u662f\u7d93\u904e\u56db\u820d\u4e94\u5165\u7684\u7d50\u679c\u3002<\/p>\n<p><!--more--><\/p>\n<h2>\u7e3d\u7d50<\/h2>\n<p>\u5728\u672c\u6587\u4e2d\uff0c\u6211\u5011\u4ecb\u7d39\u4e86\u5982\u4f55\u4f7f\u7528 React List \u7684 round \u65b9\u6cd5\u5c0d\u6578\u5b57\u9032\u884c\u56db\u820d\u4e94\u5165\u7684\u64cd\u4f5c\u3002React List \u63d0\u4f9b\u4e86\u4e00\u500b\u7c21\u55ae\u6613\u7528\u7684 round \u65b9\u6cd5\uff0c\u53ef\u4ee5\u8b93\u958b\u767c\u8005\u5feb\u901f\u5be6\u73fe\u6c42\u56db\u820d\u4e94\u5165\u7684\u529f\u80fd\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u6458\u8981\uff1a\u672c\u6587\u5c07\u4ecb\u7d39\u5982\u4f55\u4f7f\u7528React.JS\u5feb\u901f\u6c42\u53d6\u56db\u820d\u4e94\u5165\uff0c\u8a73\u7d30\u4ecb\u7d39\u4e86ReactList\u4e2dround()\u51fd\u6578\u7684\u529f\u80fd\uff0c\u4ee5\u53ca\u5982\u4f55\u4f7f\u7528\u5b83\u4f86\u6c42\u53d6\u56db\u820d\u4e94\u5165\u7684\u7d50\u679c\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-6514","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-1H4","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/posts\/6514","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=6514"}],"version-history":[{"count":1,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/posts\/6514\/revisions"}],"predecessor-version":[{"id":6515,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/posts\/6514\/revisions\/6515"}],"wp:attachment":[{"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/media?parent=6514"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/categories?post=6514"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/tags?post=6514"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}