{"id":3273,"date":"2021-07-26T21:28:14","date_gmt":"2021-07-26T13:28:14","guid":{"rendered":"http:\/\/www.yuguoxy.com\/geekhome\/?p=3273"},"modified":"2026-08-18T12:35:35","modified_gmt":"2026-08-18T04:35:35","slug":"%e6%83%b3%e5%86%99%e5%a5%bd%e5%89%8d%e7%ab%af%ef%bc%8c%e5%85%88%e7%bb%83%e5%a5%bd%e5%86%85%e5%8a%9f","status":"publish","type":"post","link":"https:\/\/ai.zhousir.top\/?p=3273","title":{"rendered":"\u60f3\u5199\u597d\u524d\u7aef\uff0c\u5148\u7ec3\u597d\u5185\u529f"},"content":{"rendered":"<section id=\"wenyan\" style=\"font-family: system-ui, 'Apple Color Emoji', 'Segoe UI', 'Segoe UI Symbol', 'Noto Sans', Roboto, sans-serif; line-height: 1.75; font-size: 16px; color: #000000; caret-color: #000000;\" data-provider=\"WenYan\">\n<p style=\"margin: 1em 0px;\">\u300a\u7b11\u50b2\u6c5f\u6e56\u300b\u91cc\u5c01\u4e0d\u5e73\u5251\u62db\u518d\u5feb\uff0c\u6ca1\u6709\u5185\u529b\u4e5f\u6491\u4e0d\u4f4f\u3002\u524d\u7aef\u540c\u6837\uff1aReact\u3001Vue\u3001Redux\u3001RN\u3001Weex \u50cf\u5404\u95e8\u62db\u5f0f\uff0c\u771f\u6b63\u80fd\u9009\u578b\u548c\u625b\u590d\u6742\u5ea6\u7684\uff0c\u662f\u62db\u5f0f\u80cc\u540e\u7684<strong style=\"color: #4870ac;\">\u5de5\u7a0b\u601d\u60f3<\/strong>\u3002<\/p>\n<p style=\"margin: 1em 0px;\">\u6587\u6863\u8fd8\u6ca1\u770b\u5b8c\u53c8\u51fa\u65b0\u6846\u67b6\uff0c\u5148\u522b\u614c\u3002\u6846\u67b6\u662f\u624b\u6bb5\uff1b\u5f00\u95ed\u539f\u5219\u3001\u51fd\u6570\u5f0f\u7f16\u7a0b\u3001\u6d88\u606f\u673a\u5236\u8fd9\u4e09\u5957\u300c\u5185\u529f\u300d\u5728\u540e\u7aef\u5f88\u5e38\u89c1\uff0c\u524d\u7aef\u6846\u67b6\u91cc\u4e5f\u5728\u7528\u3002\u4e0b\u9762\u7ed3\u5408\u4f8b\u5b50\u628a\u8fd9\u4e09\u4ef6\u4e8b\u8bf4\u6e05\u695a\u3002<\/p>\n<h2 style=\"padding: 1px 12.5px; color: #ffffff; margin: 1.2em 0px 1em; border-radius: 4px; display: inline-block; background-color: #4870ac; font-size: 1.3em;\">\u4e00\u3001\u5f00\u95ed\u539f\u5219<\/h2>\n<p style=\"margin: 1em 0px;\">\u63d0\u5230\u9762\u5411\u5bf9\u8c61\uff0c\u5f88\u591a\u4eba\u5148\u60f3\u5230 23 \u79cd\u8bbe\u8ba1\u6a21\u5f0f\u3002\u6a21\u5f0f\u662f\u5b9e\u8df5\uff0c\u4e0a\u9762\u8fd8\u6709 SOLID\uff1a<\/p>\n<ul style=\"padding-left: 1rem; margin-left: 1rem; font-size: 0.9rem; list-style-type: disc;\">\n<li>\n<section>Single Responsibility Principle \u5355\u4e00\u8d23\u4efb\u539f\u5219<\/section>\n<\/li>\n<li>\n<section>The Open Closed Principle \u5f00\u653e\u5c01\u95ed\u539f\u5219<\/section>\n<\/li>\n<li>\n<section>The Liskov Substitution Principle \u91cc\u6c0f\u66ff\u6362\u539f\u5219<\/section>\n<\/li>\n<li>\n<section>The Dependency Inversion Principle \u4f9d\u8d56\u5012\u7f6e\u539f\u5219<\/section>\n<\/li>\n<li>\n<section>The Interface Segregation Principle \u63a5\u53e3\u5206\u79bb\u539f\u5219<\/section>\n<\/li>\n<\/ul>\n<p style=\"margin: 1em 0px;\">\u51fa\u53d1\u70b9\u90fd\u662f\u300c\u9ad8\u5185\u805a\u3001\u4f4e\u8026\u5408\u300d\u3002\u540e\u7aef\u7528\u5f97\u6700\u591a\u7684\u5f80\u5f80\u662f\u4f9d\u8d56\u5012\u7f6e\uff0c\u76f8\u5173\u6a21\u5f0f\u5927\u7ea6\u4e94\u516d\u4e2a\uff1a<\/p>\n<p style=\"margin: 1em 0px;\"><a href=\"https:\/\/ai.zhousir.top\/wp-content\/uploads\/2021\/07\/TB1rnGWt8LoK1RjSZFuXXXn0XXa-692-311.png\" rel=\"fancybox\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-3274\" src=\"https:\/\/ai.zhousir.top\/wp-content\/uploads\/2021\/07\/TB1rnGWt8LoK1RjSZFuXXXn0XXa-692-311.png\" alt=\"TB1rnGWt8LoK1RjSZFuXXXn0XXa-692-311\" width=\"692\" height=\"311\" \/><\/a><\/p>\n<p style=\"margin: 1em 0px;\">\u4e0a\u56fe\u4e5f\u53ef\u4ee5\u770b\u6210\u4ece\u62bd\u8c61\u5230\u5177\u4f53\u7684\u6f14\u8fdb\u3002\u524d\u7aef\u6846\u67b6\u91cc\u7528\u5f97\u66f4\u591a\u7684\u662f\u5f00\u653e\u5c01\u95ed\u539f\u5219\uff1aA software artifact should be open for extension but closed for modification\u3002<\/p>\n<p style=\"margin: 1em 0px;\">\u7ffb\u8bd1\uff1a<strong style=\"color: #4870ac;\">\u5bf9\u6269\u5c55\u5f00\u653e\uff0c\u5bf9\u4fee\u6539\u5c01\u95ed<\/strong>\u3002\u770b\u4e00\u4e2a\u9762\u79ef\u8ba1\u7b97\u7684\u4f8b\u5b50\uff1a<\/p>\n<pre style=\"overflow: auto hidden; word-break: normal; white-space: pre; tab-size: 2; border-radius: 5px; line-height: 2; margin: 1em 0.5em; padding: 0.5em; box-shadow: rgba(0, 0, 0, 0.55) 0px 1px 5px; font-size: 12px; background: #002b36; max-width: 100%; overflow-wrap: normal;\"><code class=\"hljs\" style=\"word-break: normal; white-space: nowrap; tab-size: 2; font-size: 12px; font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; display: block; overflow-x: auto; margin: 0.5em; padding: 3px 5px; color: #93a1a1; background: #002b36; overflow-wrap: normal;\">public abstract class Shape\n{\n\tpublic abstract double Area();\n}\n\npublic class Rectangle: Shape\n{\n\tpublic double Width { get; set; }\n\tpublic double Height { get; set; }\n\tpublic override double Area()\n\t{\n\t \treturn Width * Height;\n\t}\n}\n\npublic class Circle: Shape\n{\n\tpublic double Radius { get; set; }\n\tpublic override double Area()\n\t{\n\t\treturn Radius * Radius * PI;\n\t}\n}\n\npublic double Area(Shape [] shapes)\n{\n\tdouble area = 0;\n\tforeach (var shape in shapes)\n\t{\n\t\tarea += shape.Area();\n\t}\n\treturn area;\n}<\/code><\/pre>\n<p style=\"margin: 1em 0px;\">\u573a\u666f\u518d\u6269\u5c55\uff0cArea \u6c47\u603b\u51fd\u6570\u4e5f\u4e0d\u7528\u6539\uff1b\u6bcf\u79cd Shape \u81ea\u5df1\u5b9e\u73b0\u9762\u79ef\u3002\u6838\u5fc3\u903b\u8f91\u4e0d\u8981\u8f7b\u6613\u52a8\uff0c\u5426\u5219\u7a33\u5b9a\u6027\u548c\u6d4b\u8bd5\u6210\u672c\u90fd\u4f1a\u70b8\u3002\u5e94\u5f53\u5148\u62bd\u8c61\u3001\u7edf\u4e00\u63a5\u53e3\uff0c\u6269\u5c55\u65f6\u52a0\u5b9e\u4f53\u7c7b\u3002<\/p>\n<p style=\"margin: 1em 0px;\">\u524d\u7aef\u91cc\uff0cAnt Design \u7684 Form \u5c31\u662f\u5f00\u95ed\u539f\u5219\uff1a\u5b83\u4e0d\u50cf\u666e\u901a\u63a7\u4ef6\u6709\u56fa\u5b9a\u957f\u76f8\uff0c\u66f4\u50cf\u5bb9\u5668\uff0c\u63d0\u4f9b\u63a5\u5165\u6807\u51c6\u548c\u6821\u9a8c\u3001\u63d0\u4ea4\u3002\u4e00\u9879\u53ef\u4ee5\u8fd9\u6837\u753b\uff1a<\/p>\n<pre style=\"overflow: auto hidden; word-break: normal; white-space: pre; tab-size: 2; border-radius: 5px; line-height: 2; margin: 1em 0.5em; padding: 0.5em; box-shadow: rgba(0, 0, 0, 0.55) 0px 1px 5px; font-size: 12px; background: #002b36; max-width: 100%; overflow-wrap: normal;\"><code class=\"hljs\" style=\"word-break: normal; white-space: nowrap; tab-size: 2; font-size: 12px; font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; display: block; overflow-x: auto; margin: 0.5em; padding: 3px 5px; color: #93a1a1; background: #002b36; overflow-wrap: normal;\">&lt;FormItem&gt;\n  {getFieldDecorator('userName', {\n     rules: [{ required: true, message: 'Please input your username!' }],\n     })(&lt;Input prefix={&lt;Icon type=\"user\" style={{ color: 'rgba(0,0,0,.25)' }} \/&gt;}\n\t\tplaceholder=\"Username\" \/&gt;\n   )}\n&lt;\/FormItem&gt;<\/code><\/pre>\n<p style=\"margin: 1em 0px;\">\u5e93\u91cc\u5df2\u6709 Select\u3001Checkbox\u3001Radio\u3001Cascader \u7b49\uff0c\u4e1a\u52a1\u4ecd\u4f1a\u505a\u81ea\u5b9a\u4e49\u8868\u5355\u9879\u3002Form \u7ea6\u5b9a\u4e09\u6761\u5373\u53ef\u63a5\u5165\uff1a<\/p>\n<ul style=\"padding-left: 1rem; margin-left: 1rem; font-size: 0.9rem; list-style-type: disc;\">\n<li>\n<section>\u63d0\u4f9b\u53d7\u63a7\u5c5e\u6027 <code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; color: #4870ac; font-size: 0.9em; font-weight: normal; overflow-wrap: break-word; padding: 2px 4px; border-radius: 3px; margin: 2px; background-color: #f6f8fa; word-break: break-all;\">value<\/code>\uff0c\u6216\u4e0e <code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; color: #4870ac; font-size: 0.9em; font-weight: normal; overflow-wrap: break-word; padding: 2px 4px; border-radius: 3px; margin: 2px; background-color: #f6f8fa; word-break: break-all;\">valuePropName<\/code> \u540c\u540d\u7684\u5c5e\u6027\u3002<\/section>\n<\/li>\n<li>\n<section>\u63d0\u4f9b <code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; color: #4870ac; font-size: 0.9em; font-weight: normal; overflow-wrap: break-word; padding: 2px 4px; border-radius: 3px; margin: 2px; background-color: #f6f8fa; word-break: break-all;\">onChange<\/code>\uff0c\u6216\u4e0e <code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; color: #4870ac; font-size: 0.9em; font-weight: normal; overflow-wrap: break-word; padding: 2px 4px; border-radius: 3px; margin: 2px; background-color: #f6f8fa; word-break: break-all;\">trigger<\/code> \u540c\u540d\u7684\u4e8b\u4ef6\u3002<\/section>\n<\/li>\n<li>\n<section>\u4e0d\u80fd\u662f\u51fd\u6570\u5f0f\u7ec4\u4ef6\u3002<\/section>\n<\/li>\n<\/ul>\n<p style=\"margin: 1em 0px;\"><a href=\"https:\/\/ant-design.gitee.io\/components\/form-cn\/#components-form-demo-customized-form-controls\">\u5177\u4f53\u4f8b\u5b50<\/a><\/p>\n<p style=\"margin: 1em 0px;\">\u6821\u9a8c\u3001\u63d0\u4ea4\u5c01\u5728 Form \u91cc\u4e0d\u53d8\uff1b\u81ea\u5b9a\u4e49\u63a7\u4ef6\u6ee1\u8db3\u7ea6\u5b9a\u5c31\u80fd\u548c\u5b98\u65b9\u63a7\u4ef6\u4e00\u8d77\u7528\u3002\u8fd9\u5c31\u662f\u5f00\u95ed\uff1a\u6838\u5fc3\u5c01\u95ed\uff0c\u6269\u5c55\u8d70\u63a5\u53e3\u3002<\/p>\n<h2 style=\"padding: 1px 12.5px; color: #ffffff; margin: 1.2em 0px 1em; border-radius: 4px; display: inline-block; background-color: #4870ac; font-size: 1.3em;\">\u4e8c\u3001\u51fd\u6570\u5f0f\u7f16\u7a0b<\/h2>\n<p style=\"margin: 1em 0px;\">\u4ea4\u4e92\u8d8a\u6765\u8d8a\u590d\u6742\uff0cFP \u51ed\u590d\u7528\u3001\u597d\u6d4b\u3001\u4ee3\u7801\u66f4\u77ed\uff0c\u6210\u4e86\u5f88\u591a\u6846\u67b6\u7684\u8bbe\u8ba1\u51c6\u5219\u3002\u7279\u5f81\u5927\u81f4\u662f\uff1a<\/p>\n<ul style=\"padding-left: 1rem; margin-left: 1rem; font-size: 0.9rem; list-style-type: disc;\">\n<li>\n<section>\u51fd\u6570\u4e3a\u300c\u4e00\u7b49\u516c\u6c11\u300d<\/section>\n<\/li>\n<li>\n<section>\u6a21\u5757\u5316\u3001\u7ec4\u5408<\/section>\n<\/li>\n<li>\n<section>\u5f15\u7528\u900f\u660e<\/section>\n<\/li>\n<li>\n<section>\u907f\u514d\u72b6\u6001\u6539\u53d8<\/section>\n<\/li>\n<li>\n<section>\u907f\u514d\u5171\u4eab\u72b6\u6001<\/section>\n<\/li>\n<\/ul>\n<p style=\"margin: 1em 0px;\">JS \u51fd\u6570\u53ef\u5f53\u53c2\u6570\u548c\u8fd4\u56de\u503c\uff0c\u5929\u751f\u662f\u4e00\u7b49\u516c\u6c11\u3002\u540e\u9762\u56db\u6761\u8981\u9760\u5199\u6cd5\u843d\u5730\u3002<\/p>\n<h3 style=\"padding: 0px; color: #4870ac; margin: 1.2em 0px 1em; font-size: 1.3em;\">\u627e\u51fa\u5b57\u7b26\u4e32\u4e2d\u7387\u5148\u51fa\u73b0\u7684\u56db\u4e2a\u975e\u6570\u5b57\u5b57\u7b26<\/h3>\n<p style=\"margin: 1em 0px;\">\u975e FP\uff1a<\/p>\n<pre style=\"overflow: auto hidden; word-break: normal; white-space: pre; tab-size: 2; border-radius: 5px; line-height: 2; margin: 1em 0.5em; padding: 0.5em; box-shadow: rgba(0, 0, 0, 0.55) 0px 1px 5px; font-size: 12px; background: #002b36; max-width: 100%; overflow-wrap: normal;\"><code class=\"hljs\" style=\"word-break: normal; white-space: nowrap; tab-size: 2; font-size: 12px; font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; display: block; overflow-x: auto; margin: 0.5em; padding: 3px 5px; color: #93a1a1; background: #002b36; overflow-wrap: normal;\">var words = [], count = 0;\nvar text = str.split('');\nfor (var i = 0; count &lt; 4 &amp;&amp; i &lt; text.length; i++) {\n  if(!text[i].match(\/[0-9]\/)) {\n    words = words.concat(text[i]);\n    count++;\n  }\n}<\/code><\/pre>\n<p style=\"margin: 1em 0px;\">FP\uff1a<\/p>\n<pre style=\"overflow: auto hidden; word-break: normal; white-space: pre; tab-size: 2; border-radius: 5px; line-height: 2; margin: 1em 0.5em; padding: 0.5em; box-shadow: rgba(0, 0, 0, 0.55) 0px 1px 5px; font-size: 12px; background: #002b36; max-width: 100%; overflow-wrap: normal;\"><code class=\"hljs\" style=\"word-break: normal; white-space: nowrap; tab-size: 2; font-size: 12px; font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; display: block; overflow-x: auto; margin: 0.5em; padding: 3px 5px; color: #93a1a1; background: #002b36; overflow-wrap: normal;\">var words = str.split('').filter(function(x){\n  return (!x.match(\/[0-9]\/))}).slice(0,4);<\/code><\/pre>\n<p style=\"margin: 1em 0px;\">\u7528 <code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; color: #4870ac; font-size: 0.9em; font-weight: normal; overflow-wrap: break-word; padding: 2px 4px; border-radius: 3px; margin: 2px; background-color: #f6f8fa; word-break: break-all;\">filter<\/code>\u3001<code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; color: #4870ac; font-size: 0.9em; font-weight: normal; overflow-wrap: break-word; padding: 2px 4px; border-radius: 3px; margin: 2px; background-color: #f6f8fa; word-break: break-all;\">slice<\/code> \u62ff\u6389 for\uff0c\u66f4\u987a\u3002\u539f\u6587 FP \u793a\u4f8b\u5199\u6210\u4e86 <code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; color: #4870ac; font-size: 0.9em; font-weight: normal; overflow-wrap: break-word; padding: 2px 4px; border-radius: 3px; margin: 2px; background-color: #f6f8fa; word-break: break-all;\">\/[1-9]+\/<\/code>\uff0c\u4f1a\u628a <code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; color: #4870ac; font-size: 0.9em; font-weight: normal; overflow-wrap: break-word; padding: 2px 4px; border-radius: 3px; margin: 2px; background-color: #f6f8fa; word-break: break-all;\">0<\/code> \u5f53\u6210\u975e\u6570\u5b57\u7559\u4e0b\uff0c\u548c\u9898\u610f\u300c\u975e\u6570\u5b57\u300d\u4e0d\u4e00\u81f4\uff0c\u8fd9\u91cc\u6309 <code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; color: #4870ac; font-size: 0.9em; font-weight: normal; overflow-wrap: break-word; padding: 2px 4px; border-radius: 3px; margin: 2px; background-color: #f6f8fa; word-break: break-all;\">[0-9]<\/code> \u5bf9\u9f50\u3002\u4e1a\u52a1\u91cc\u6700\u5e38\u7528\u7684\u662f\u6a21\u5757\u5316\u7ec4\u5408\u3002<\/p>\n<h3 style=\"padding: 0px; color: #4870ac; margin: 1.2em 0px 1em; font-size: 1.3em;\">\u6570\u7ec4\u5143\u7d20\u76f8\u52a0\u3001\u76f8\u4e58\u3001\u76f8\u4e0e<\/h3>\n<p style=\"margin: 1em 0px;\">\u975e FP\uff1a\u6bcf\u79cd\u8fd0\u7b97\u590d\u5236\u4e00\u4efd\u5faa\u73af\u3002<\/p>\n<pre style=\"overflow: auto hidden; word-break: normal; white-space: pre; tab-size: 2; border-radius: 5px; line-height: 2; margin: 1em 0.5em; padding: 0.5em; box-shadow: rgba(0, 0, 0, 0.55) 0px 1px 5px; font-size: 12px; background: #002b36; max-width: 100%; overflow-wrap: normal;\"><code class=\"hljs\" style=\"word-break: normal; white-space: nowrap; tab-size: 2; font-size: 12px; font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; display: block; overflow-x: auto; margin: 0.5em; padding: 3px 5px; color: #93a1a1; background: #002b36; overflow-wrap: normal;\">function plus(array) {\n  var res = array[0];\n  for (let i = 1; i &lt; array.length; i++) {\n    res += array[i];\n  }\n}\n\nfunction mul(array) {\n  var res = array[0];\n  for (let i = 1; i &lt; array.length; i++) {\n    res *= array[i];\n  }\n}\n\nfunction and (array) {\n  var res = array[0];\n  for (let i = 1; i &lt; array.length; i++) {\n    res = res &amp; array[i];\n  }\n}\n\nplus(array);\nmul(array);\nand(array);<\/code><\/pre>\n<p style=\"margin: 1em 0px;\">FP\uff1a\u8fd0\u7b97\u62bd\u6210\u6a21\u5757\uff0c\u5faa\u73af\u7528 reduce\uff1a<\/p>\n<pre style=\"overflow: auto hidden; word-break: normal; white-space: pre; tab-size: 2; border-radius: 5px; line-height: 2; margin: 1em 0.5em; padding: 0.5em; box-shadow: rgba(0, 0, 0, 0.55) 0px 1px 5px; font-size: 12px; background: #002b36; max-width: 100%; overflow-wrap: normal;\"><code class=\"hljs\" style=\"word-break: normal; white-space: nowrap; tab-size: 2; font-size: 12px; font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; display: block; overflow-x: auto; margin: 0.5em; padding: 3px 5px; color: #93a1a1; background: #002b36; overflow-wrap: normal;\">var ops = {\n  \"plus\": (x,y)=&gt;x+y,\n  \"mul\" : (x,y)=&gt;x*y,\n  \"and\" : (x,y)=&gt;x&amp;y\n}\n\nfunction operation(op, array) {\n  return array.slice(1).reduce(ops[op], array[0]);\n}\n\noperation(\"plus\", array);\noperation(\"mul\",  array);\noperation(\"and\",  array);<\/code><\/pre>\n<p style=\"margin: 1em 0px;\">\u65b0\u8fd0\u7b97\u53ea\u9700\u5728 ops \u91cc\u52a0\u4e00\u9879\u3002\u590d\u6742\u903b\u8f91\u5207\u5c0f\u5757\u518d\u7ec4\u5408\uff0c\u590d\u7528\u5f80\u5f80\u6bd4 OOD \u66f4\u987a\u624b\u3002\u62c6\u592a\u7ec6\u6587\u4ef6\u548c\u6c9f\u901a\u6210\u672c\u4f1a\u6da8\uff0c\u8fd9\u662f\u5b9e\u8df5\u91cc\u5e38\u88ab\u62b1\u6028\u7684\u70b9\u3002<\/p>\n<h3 style=\"padding: 0px; color: #4870ac; margin: 1.2em 0px 1em; font-size: 1.3em;\">React \u91cc\u7684 FP<\/h3>\n<p style=\"margin: 1em 0px;\">\u7528\u6237\u64cd\u4f5c\u6216\u63a5\u53e3\u6539\u6570\u636e\u540e\uff0cReact \u505a virtual DOM diff\uff0c\u5f97\u5230\u4fee\u6539\u6307\u4ee4\u518d\u6253\u5230\u771f\u5b9e DOM\uff1a<\/p>\n<p style=\"margin: 1em 0px;\"><a href=\"https:\/\/ai.zhousir.top\/wp-content\/uploads\/2021\/07\/TB1zEuZt4TpK1RjSZFGXXcHqFXa-1120-530.png\" rel=\"fancybox\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone  wp-image-3275\" src=\"https:\/\/ai.zhousir.top\/wp-content\/uploads\/2021\/07\/TB1zEuZt4TpK1RjSZFGXXcHqFXa-1120-530.png\" alt=\"TB1zEuZt4TpK1RjSZFGXXcHqFXa-1120-530\" width=\"765\" height=\"362\" \/><\/a><\/p>\n<p style=\"margin: 1em 0px;\">UI \u662f\u6570\u636e\u7684\u6620\u5c04\uff0c\u53ef\u4ee5\u5199\u6210 UI = React(data)\u3002<\/p>\n<p style=\"margin: 1em 0px;\"><strong style=\"color: #4870ac;\">React \u7684\u672c\u8d28\u662f\u4e00\u79cd\u51fd\u6570<\/strong>\uff0c\u800c\u4e14\u63a5\u8fd1\u300c\u5f15\u7528\u900f\u660e\u300d\uff1a\u8f93\u51fa\u53ea\u770b\u53c2\u6570\uff0c\u4e0d\u770b\u5916\u90e8\u73af\u5883\u3002\u8fd9\u6837\u597d\u6d4b\u3001\u597d\u7ec4\u5408\u3002\u7ec4\u4ef6\u7531\u66f4\u5c0f\u7ec4\u4ef6\u6784\u6210\uff0c\u9ad8\u9636\u7ec4\u4ef6\u5c31\u662f\u900f\u660e\u51fd\u6570\u7684\u7ec4\u5408\u3002<\/p>\n<h2 style=\"padding: 1px 12.5px; color: #ffffff; margin: 1.2em 0px 1em; border-radius: 4px; display: inline-block; background-color: #4870ac; font-size: 1.3em;\">\u4e09\u3001\u6d88\u606f\u673a\u5236<\/h2>\n<p style=\"margin: 1em 0px;\">\u89c2\u5bdf\u8005\u6a21\u5f0f\u3001Windows \u6d88\u606f\u3001Spring ApplicationListener\u3001Objective-C \u7684\u65b9\u6cd5\u8c03\u7528\uff0c\u90fd\u9760\u6d88\u606f\u9a71\u52a8\u3002\u597d\u5904\u662f\u6a21\u5757\u89e3\u8026\uff0c\u5f7c\u6b64\u53ea\u53d1\u6d88\u606f\u3002<\/p>\n<p style=\"margin: 1em 0px;\">\u6ca1\u6709\u6d88\u606f\u65f6\uff0c\u9884\u5b9a\u7cfb\u7edf\u91cc\u7528\u6237\u8981\u77e5\u9053\u8ba2\u5355\u3001\u8ba2\u5355\u8981\u77e5\u9053\u652f\u4ed8\uff0c\u6a21\u5757\u4e92\u76f8\u8c03\u7528\uff1a<\/p>\n<p style=\"margin: 1em 0px;\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-3276\" src=\"https:\/\/ai.zhousir.top\/wp-content\/uploads\/2021\/07\/TB1Uvrot4naK1RjSZFtXXbC2VXa-692-413.png\" alt=\"TB1Uvrot4naK1RjSZFtXXbC2VXa-692-413\" width=\"692\" height=\"413\" \/><\/p>\n<p style=\"margin: 1em 0px;\">\u6539\u6210\u6d88\u606f\u540e\uff0c\u4e0b\u5355\u3001\u652f\u4ed8\u3001\u9884\u5b9a\u90fd\u53d1\u7ed9\u6d88\u606f\u5904\u7406\u5668\uff0c\u540c\u65f6\u542c\u56de\u6765\u7684\u6d88\u606f\u3002\u6a21\u5757\u4e0d\u77e5\u9053\u5bf9\u65b9\u5b58\u5728\uff1a<\/p>\n<p style=\"margin: 1em 0px;\"><a href=\"https:\/\/ai.zhousir.top\/wp-content\/uploads\/2021\/07\/TB1Ose4t3HqK1RjSZJnXXbNLpXa-692-483.png\" rel=\"fancybox\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-3277\" src=\"https:\/\/ai.zhousir.top\/wp-content\/uploads\/2021\/07\/TB1Ose4t3HqK1RjSZJnXXbNLpXa-692-483.png\" alt=\"TB1Ose4t3HqK1RjSZJnXXbNLpXa-692-483\" width=\"692\" height=\"483\" \/><\/a><\/p>\n<p style=\"margin: 1em 0px;\">\u524d\u7aef\u91cc\u5e38\u7528 <code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; color: #4870ac; font-size: 0.9em; font-weight: normal; overflow-wrap: break-word; padding: 2px 4px; border-radius: 3px; margin: 2px; background-color: #f6f8fa; word-break: break-all;\">EventEmitter<\/code>\u3002\u540c\u4e00\u9875\u4e00\u5757 React\u3001\u4e00\u5757 D3\uff0c\u8981\u540c\u6b65\u6570\u636e\u5c31\u53ef\u4ee5\u8d70\u6d88\u606f\u3002\u4e0d\u540c\u751f\u547d\u5468\u671f\u7684\u7ec4\u4ef6\u7528\u6d88\u606f\u7ba1\uff0c<strong style=\"color: #4870ac;\">\u8026\u5408\u4e0b\u53bb\u3001\u5173\u7cfb\u4ee3\u7801\u6536\u5230\u4e00\u4e2a\u6587\u4ef6\uff0c\u5185\u805a\u4e0a\u6765<\/strong>\u3002<\/p>\n<p style=\"margin: 1em 0px;\">\u6d88\u606f\u8fd8\u5e26\u51fa\u4e2d\u95f4\u4ef6\uff1a\u901a\u7528\u903b\u8f91\u653e\u4e2d\u95f4\u4ef6\uff0c\u4e1a\u52a1\u66f4\u77ed\u3002\u524d\u7aef\u91cc\u6700\u5178\u578b\u7684\u662f Redux\uff1a\u4ea4\u4e92\u5148\u53d8\u6210 action\uff0c\u7ecf reducer \u548c middleware \u6539\u6570\u636e\uff0c\u518d\u540c\u6b65 UI\uff1a<\/p>\n<p style=\"margin: 1em 0px;\"><a href=\"https:\/\/ai.zhousir.top\/wp-content\/uploads\/2021\/07\/TB1zeyZtYPpK1RjSZFFXXa5PpXa-692-439.png\" rel=\"fancybox\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-3278\" src=\"https:\/\/ai.zhousir.top\/wp-content\/uploads\/2021\/07\/TB1zeyZtYPpK1RjSZFFXXa5PpXa-692-439.png\" alt=\"TB1zeyZtYPpK1RjSZFFXXa5PpXa-692-439\" width=\"692\" height=\"439\" \/><\/a><\/p>\n<p style=\"margin: 1em 0px;\">Redux \u7684\u5229\u5f0a\u793e\u533a\u8ba8\u8bba\u5f88\u591a\uff0c\u8fd9\u91cc\u4e0d\u5c55\u5f00\u3002<\/p>\n<table style=\"display: table; text-align: left; overflow: auto; border-collapse: collapse; margin: 1.4em auto; max-width: 100%; table-layout: fixed; overflow-wrap: break-word; word-break: break-all;\" width=\"800\">\n<thead>\n<tr>\n<th style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top; text-align: center; font-weight: bold; color: #4870ac; background: #f7f7f7;\">\u5185\u529f<\/th>\n<th style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top; text-align: center; font-weight: bold; color: #4870ac; background: #f7f7f7;\">\u4e00\u53e5\u8bdd<\/th>\n<th style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top; text-align: center; font-weight: bold; color: #4870ac; background: #f7f7f7;\">\u524d\u7aef\u843d\u70b9<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">\u5f00\u95ed\u539f\u5219<\/td>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">\u6838\u5fc3\u522b\u6539\uff0c\u6269\u5c55\u8d70\u63a5\u53e3<\/td>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">Ant Design Form \u7684 value \/ onChange \u7ea6\u5b9a<\/td>\n<\/tr>\n<tr>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">\u51fd\u6570\u5f0f<\/td>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">\u5c0f\u51fd\u6570\u7ec4\u5408\uff0c\u5f15\u7528\u900f\u660e<\/td>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">React\uff1aUI = f(data)\uff1breduce \/ \u9ad8\u9636\u7ec4\u4ef6<\/td>\n<\/tr>\n<tr>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">\u6d88\u606f\u673a\u5236<\/td>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">\u6a21\u5757\u53ea\u53d1\u6d88\u606f\u3001\u4e0d\u4e92\u8c03<\/td>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">EventEmitter\uff1bRedux \u7684 action<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2 style=\"padding: 1px 12.5px; color: #ffffff; margin: 1.2em 0px 1em; border-radius: 4px; display: inline-block; background-color: #4870ac; font-size: 1.3em;\">\u56db\u3001\u53c2\u8003<\/h2>\n<ul style=\"padding-left: 1rem; margin-left: 1rem; font-size: 0.9rem; list-style-type: disc;\">\n<li>\n<section>Functional Programming in JavaScript \u2014 Dan Mantyla<\/section>\n<\/li>\n<li>\n<section>Functional JavaScript: Introducing Functional Programming with Underscore.js \u2014 Michael Fogus<\/section>\n<\/li>\n<li>\n<section>Clean Architecture \u2014 Robert C. Martin<\/section>\n<\/li>\n<li>\n<section><a class=\"url\" href=\"https:\/\/reactjs.org\" target=\"_blank\">https:\/\/reactjs.org<\/a><\/section>\n<\/li>\n<li>\n<section><a class=\"url\" href=\"https:\/\/ant-design.gitee.io\/docs\/react\/introduce-cn\" target=\"_blank\">https:\/\/ant-design.gitee.io\/docs\/react\/introduce-cn<\/a><\/section>\n<\/li>\n<li>\n<section><a class=\"url\" href=\"https:\/\/redux.js.org\/\" target=\"_blank\">https:\/\/redux.js.org\/<\/a><\/section>\n<\/li>\n<li>\n<section><a class=\"url\" href=\"https:\/\/redux-saga.js.org\/\" target=\"_blank\">https:\/\/redux-saga.js.org\/<\/a><\/section>\n<\/li>\n<li>\n<section>\u300a\u7b11\u50b2\u6c5f\u6e56\u300b\u2014 \u91d1\u5eb8<\/section>\n<\/li>\n<li>\n<section>\u300a\u5929\u9f99\u516b\u90e8\u300b\u2014 \u91d1\u5eb8\u3000\u539f\u6587\u94fe\u63a5\uff1ahttps:\/\/www.yuque.com\/es2049\/blog<\/section>\n<\/li>\n<\/ul>\n<blockquote style=\"display: block; font-size: 0.9em; border-left: 3px solid #4870ac; padding: 0.5em 1em; margin: 0px; background: #f6f8fa; color: #40464f;\">\n<p style=\"margin: 1em 0px;\"><strong style=\"color: #4870ac;\">\u4e00\u53e5\u8bdd\u603b\u7ed3\uff1a\u62db\u5f0f\u4f1a\u8fc7\u65f6\uff0c\u5f00\u95ed\u3001\u51fd\u6570\u5f0f\u3001\u6d88\u606f\u8fd9\u4e09\u5957\u5185\u529f\u80fd\u5e2e\u4f60\u770b\u61c2\u6846\u67b6\u4e3a\u4ec0\u4e48\u8fd9\u4e48\u8bbe\u8ba1\uff0c\u9009\u578b\u624d\u6709\u4f9d\u636e\u3002<\/strong><\/p>\n<\/blockquote>\n<\/section>\n","protected":false},"excerpt":{"rendered":"<p>\u300a\u7b11\u50b2\u6c5f\u6e56\u300b\u91cc\u5c01\u4e0d\u5e73\u5251\u62db\u518d\u5feb\uff0c\u6ca1\u6709\u5185\u529b\u4e5f\u6491\u4e0d\u4f4f\u3002\u524d\u7aef\u540c\u6837\uff1aReact\u3001Vue\u3001Redux\u3001RN\u3001Weex \u50cf\u5404 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[105,127],"tags":[209],"_links":{"self":[{"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=\/wp\/v2\/posts\/3273"}],"collection":[{"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3273"}],"version-history":[{"count":2,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=\/wp\/v2\/posts\/3273\/revisions"}],"predecessor-version":[{"id":3280,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=\/wp\/v2\/posts\/3273\/revisions\/3280"}],"wp:attachment":[{"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3273"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3273"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3273"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}