{"id":27865,"date":"2020-05-29T17:08:37","date_gmt":"2020-05-29T09:08:37","guid":{"rendered":"http:\/\/www.zhushiyao.com\/?p=27865"},"modified":"2020-05-29T17:09:06","modified_gmt":"2020-05-29T09:09:06","slug":"b3c8cc18eb","status":"publish","type":"post","link":"http:\/\/www.zhushiyao.com\/?p=27865","title":{"rendered":"\u5c24\u96e8\u6eaa\u81ea\u8ff0\uff1a\u6253\u9020Vue 3\u80cc\u540e\u7684\u6545\u4e8b"},"content":{"rendered":"<div class=\"bpp-post-content\">\n<section style=\"color: #3f3f3f; font-size: 16px; font-family: Avenir, -apple-system-font, \u5fae\u8f6f\u96c5\u9ed1, sans-serif;\">\n<section style=\"color: #3f3f3f; font-size: 16px; font-family: Avenir, -apple-system-font, \u5fae\u8f6f\u96c5\u9ed1, sans-serif;\">\n<section style=\"text-align: left;\"><\/section>\n<\/section>\n<section style=\"font-size: 14px; color: #919191; text-align: left; line-height: 1em; margin-top: 13px; padding-left: 14px;\">\u4f5c\u8005 | \u5c24\u96e8\u6eaa<\/section>\n<section style=\"font-size: 14px; color: #919191; text-align: left; line-height: 1em; margin-top: 13px; padding-left: 14px;\">\u8bd1\u8005 | \u738b\u5f3a<\/section>\n<section style=\"font-size: 14px; color: #919191; text-align: left; line-height: 1em; margin-top: 13px; padding-left: 14px;\">\u7f16\u8f91 | \u8521\u82b3\u82b3<\/section>\n<section style=\"font-size: 15px; line-height: 27px; color: #595959; background-color: #efefef; padding: 19px; margin-top: 40px; margin-right: 8px; margin-left: 8px;\">\u5c24\u96e8\u6eaa\u5728\u4eca\u5e74\u5e74\u521d Vue 3 \u6b63\u5f0f\u53d1\u5e03\u4e4b\u524d\u64b0\u5199\u4e86\u8fd9\u7bc7\u957f\u6587\uff0c\u8be6\u8ff0 Vue 3 \u7684\u8bbe\u8ba1\u8fc7\u7a0b\u3002\u524d\u7aef\u4e4b\u5dc5\u5c06\u5168\u6587\u7ffb\u8bd1\u5982\u4e0b\uff0c\u5e0c\u671b\u80fd\u5e2e\u52a9\u4f60\u66f4\u597d\u5730\u4e86\u89e3 Vue 3 \u80cc\u540e\u7684\u6545\u4e8b\u3002<\/section>\n<p style=\"white-space: pre-line; padding-top: 23px; padding-right: 8px; padding-left: 8px; color: #4a4a4a; line-height: 1.75em;\">\u5728\u8fc7\u53bb\u7684\u4e00\u5e74\u4e2d\uff0cVue \u56e2\u961f\u4e00\u76f4\u90fd\u5728\u5f00\u53d1 Vue.js \u7684\u4e0b\u4e00\u4e2a\u4e3b\u8981\u7248\u672c\uff0c\u6211\u4eec\u5e0c\u671b\u80fd\u5728\u4eca\u5e74\u4e0a\u534a\u5e74\u53d1\u5e03\u5b83\uff08\u672c\u6587\u5b8c\u6210\u65f6\u8fd9\u9879\u5de5\u4f5c\u5c1a\u5728\u8fdb\u884c\uff09\u3002Vue \u65b0\u7248\u672c\u7684\u7406\u5ff5\u6210\u578b\u4e8e 2018 \u5e74\u672b\uff0c\u5f53\u65f6 Vue 2 \u7684\u4ee3\u7801\u5e93\u5df2\u7ecf\u6709\u4e24\u5c81\u534a\u4e86\u3002\u6bd4\u8d77\u901a\u7528\u8f6f\u4ef6\u7684\u751f\u547d\u5468\u671f\u6765\u8fd9\u597d\u50cf\u4e5f\u6ca1\u90a3\u4e48\u4e45\uff0c\u4f46\u5728\u8fd9\u6bb5\u65f6\u671f\uff0c\u524d\u7aef\u4e16\u754c\u5df2\u7ecf\u4eca\u6614\u975e\u6bd4\u4e86\u3002<\/p>\n<p style=\"white-space: pre-line; padding-top: 23px; padding-right: 8px; padding-left: 8px; color: #4a4a4a; line-height: 1.75em;\">\u5728\u6211\u4eec\u66f4\u65b0\uff08\u548c\u91cd\u5199\uff09Vue \u7684\u4e3b\u8981\u7248\u672c\u65f6\uff0c\u4e3b\u8981\u8003\u8651\u4e24\u70b9\u56e0\u7d20\uff1a\u9996\u5148\u662f\u65b0\u7684 JavaScript \u8bed\u8a00\u7279\u6027\u5728\u4e3b\u6d41\u6d4f\u89c8\u5668\u4e2d\u7684\u53d7\u652f\u6301\u6c34\u5e73\uff1b\u5176\u6b21\u662f\u5f53\u524d\u4ee3\u7801\u5e93\u4e2d\u968f\u65f6\u95f4\u63a8\u79fb\u800c\u9010\u6e10\u66b4\u9732\u51fa\u6765\u7684\u4e00\u4e9b\u8bbe\u8ba1\u548c\u67b6\u6784\u95ee\u9898\u3002<\/p>\n<section style=\"text-align: center; font-size: 20px;\"><span style=\"height: 65px; line-height: 95px; color: #3c70c6; border-bottom: 2px solid #1b5fa0; background-image: url('http:\/\/www.zhushiyao.com\/wp-content\/uploads\/2020\/05\/3-1590743317.jpeg'); background-position: 50% 50%; background-repeat: no-repeat; background-attachment: initial; background-origin: initial; background-clip: initial; background-size: 92px; margin-top: 38px; margin-bottom: 10px; padding-bottom: 7px; display: inline-block;\">\u4e3a\u4ec0\u4e48\u91cd\u5199<\/span><\/section>\n<section style=\"text-align: center;\"><span style=\"display: inline-block; height: 38px; line-height: 42px; color: #3c70c6; background-image: url('http:\/\/www.zhushiyao.com\/wp-content\/uploads\/2020\/05\/3-1590743317.jpeg'); background-position: left center; background-repeat: no-repeat; background-attachment: initial; background-origin: initial; background-clip: initial; background-size: 63px; padding-left: 35px; margin-top: 38px; margin-bottom: 10px;\">\u5229\u7528\u65b0\u7684\u8bed\u8a00\u7279\u6027<\/span><\/section>\n<p style=\"white-space: pre-line; padding-top: 23px; padding-right: 8px; padding-left: 8px; color: #4a4a4a; line-height: 1.75em;\">\u968f\u7740 ES2015 \u6807\u51c6\u7684\u843d\u5730\uff0cJavaScript\uff08\u4ee5\u524d\u88ab\u79f0\u4e3a ECMAScript\uff0c\u7f29\u5199\u4e3a ES\uff09\u83b7\u5f97\u4e86\u8bf8\u591a\u91cd\u5927\u6539\u8fdb\uff0c\u540c\u65f6\u4e3b\u6d41\u6d4f\u89c8\u5668\u4e5f\u7ec8\u4e8e\u5f00\u59cb\u5bf9\u8fd9\u4e9b\u65b0\u7279\u6027\u63d0\u4f9b\u826f\u597d\u7684\u652f\u6301\u4e86\u3002\u5176\u4e2d\u7684\u4e00\u4e9b\u7279\u6027\u4f7f\u6211\u4eec\u80fd\u591f\u5927\u5e45\u63d0\u5347 Vue \u7684\u80fd\u529b\u3002<\/p>\n<p style=\"white-space: pre-line; padding-top: 23px; padding-right: 8px; padding-left: 8px; color: #4a4a4a; line-height: 1.75em;\">\u8fd9\u91cc\u9762\u6700\u503c\u5f97\u4e00\u63d0\u7684\u5c31\u662f Proxy\uff1a<\/p>\n<p style=\"white-space: pre-line; padding-top: 23px; padding-right: 8px; padding-left: 8px; color: #4a4a4a; line-height: 1.75em;\"><span style=\"color: #888888; font-size: 14px;\">https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/JavaScript\/Reference\/Global_Objects\/Proxy<\/span><\/p>\n<p style=\"white-space: pre-line; padding-top: 23px; padding-right: 8px; padding-left: 8px; color: #4a4a4a; line-height: 1.75em;\">\u5b83\u4e3a\u6846\u67b6\u63d0\u4f9b\u4e86\u62e6\u622a\u9488\u5bf9\u5bf9\u8c61\u7684\u64cd\u4f5c\u7684\u80fd\u529b\u3002Vue \u7684\u4e00\u9879\u6838\u5fc3\u7279\u6027\u5c31\u662f\u76d1\u542c\u7528\u6237\u5b9a\u4e49\u72b6\u6001\u7684\u53d8\u5316\uff0c\u5e76\u54cd\u5e94\u5f0f\u66f4\u65b0 DOM\u3002Vue 2 \u662f\u901a\u8fc7\u66ff\u6362\u72b6\u6001\u5bf9\u8c61\u5c5e\u6027\u7684 getter \u548c setter \u6765\u5b9e\u73b0\u8fd9\u79cd\u54cd\u5e94\u80fd\u529b\u7684\u3002\u8f6c\u5411 Proxy \u540e\uff0c\u6211\u4eec\u5c31\u80fd\u89e3\u51b3 Vue \u5f53\u4e0b\u5b58\u5728\u7684\u8bf8\u591a\u5c40\u9650\uff08\u6bd4\u5982\u65e0\u6cd5\u68c0\u6d4b\u65b0\u589e\u5c5e\u6027\u7b49\uff09\uff0c\u8fd8\u80fd\u63d0\u4f9b\u66f4\u597d\u7684\u6027\u80fd\u3002<\/p>\n<p style=\"white-space: pre-line; padding-top: 23px; padding-right: 8px; padding-left: 8px; color: #4a4a4a; line-height: 1.75em;\">\u4f46 Proxy \u662f\u4e00\u4e2a\u539f\u751f\u7684\u8bed\u8a00\u7279\u6027\uff0c\u65e0\u6cd5\u5728\u8001\u5f0f\u6d4f\u89c8\u5668\u4e2d\u63d0\u4f9b\u5b8c\u6574\u7684 polyfill\u3002\u4e3a\u6b64\u6211\u4eec\u9700\u8981\u6539\u52a8\u65b0\u7248\u6846\u67b6\u7684\u6d4f\u89c8\u5668\u652f\u6301\u8303\u56f4\u2014\u2014\u8fd9\u662f\u4e00\u9879\u7834\u574f\u6027\u53d8\u66f4\uff0c\u53ea\u6709\u65b0\u7684\u4e3b\u8981\u7248\u672c\u624d\u80fd\u5b9e\u73b0\u3002<\/p>\n<section style=\"text-align: center; font-size: 20px;\"><span style=\"height: 65px; line-height: 95px; color: #3c70c6; border-bottom: 2px solid #1b5fa0; background-image: url('http:\/\/www.zhushiyao.com\/wp-content\/uploads\/2020\/05\/3-1590743317.jpeg'); background-position: 50% 50%; background-repeat: no-repeat; background-attachment: initial; background-origin: initial; background-clip: initial; background-size: 92px; margin-top: 38px; margin-bottom: 10px; padding-bottom: 7px; display: inline-block;\">\u89e3\u51b3\u67b6\u6784\u95ee\u9898<\/span><\/section>\n<blockquote style=\"margin-top: 0px; margin-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: none;\">\n<p style=\"font-size: 16px; white-space: pre-line; line-height: 1.75em; margin-top: 27px; padding-right: 20px; padding-left: 20px; color: #5baceb;\">\u5728\u73b0\u6709\u4ee3\u7801\u5e93\u4e0a\u4fee\u590d\u8fd9\u4e9b\u95ee\u9898\u9700\u8981\u5927\u91cf\u9ad8\u98ce\u9669\u7684\u91cd\u6784\u5de5\u4f5c\uff0c\u51e0\u4e4e\u7b49\u540c\u4e8e\u91cd\u5199\u4e86\u3002<\/p>\n<\/blockquote>\n<p style=\"white-space: pre-line; padding-top: 23px; padding-right: 8px; padding-left: 8px; color: #4a4a4a; line-height: 1.75em;\">\u5728\u7ef4\u62a4 Vue 2 \u7684\u8fc7\u7a0b\u4e2d\uff0c\u6211\u4eec\u79ef\u7d2f\u7684\u5f88\u591a\u95ee\u9898\u53d7\u9650\u4e8e\u73b0\u6709\u7684\u67b6\u6784\u662f\u5f88\u96be\u89e3\u51b3\u7684\u3002\u4f8b\u5982\uff0c\u6a21\u677f\u7f16\u8bd1\u5668\u7684\u5199\u6cd5\u4f7f\u6211\u4eec\u5f88\u96be\u5b9e\u73b0\u826f\u597d\u7684\u6e90\u6620\u5c04\u652f\u6301\u3002\u53e6\u5916\uff0c\u867d\u7136 Vue 2 \u6280\u672f\u4e0a\u652f\u6301\u6784\u5efa\u4ee5\u975e DOM \u5e73\u53f0\u4e3a\u76ee\u6807\u7684\u9ad8\u7ea7\u6e32\u67d3\u5668\uff0c\u4f46\u4e3a\u4e86\u5b9e\u73b0\u8fd9\u4e00\u652f\u6301\uff0c\u6211\u4eec\u9700\u8981 fork \u4ee3\u7801\u5e93\uff0c\u8fd8\u5f97\u590d\u5236\u4e00\u5927\u5806\u4ee3\u7801\u3002\u5728\u73b0\u6709\u4ee3\u7801\u5e93\u4e0a\u4fee\u590d\u8fd9\u4e9b\u95ee\u9898\u9700\u8981\u5927\u91cf\u9ad8\u98ce\u9669\u7684\u91cd\u6784\u5de5\u4f5c\uff0c\u51e0\u4e4e\u5df2\u7ecf\u7b49\u540c\u4e8e\u91cd\u5199\u4e86\u3002<\/p>\n<p style=\"white-space: pre-line; padding-top: 23px; padding-right: 8px; padding-left: 8px; color: #4a4a4a; line-height: 1.75em;\">\u540c\u65f6\uff0c\u6211\u4eec\u5728\u5f88\u591a\u5185\u90e8\u6a21\u5757\u4e0e\u770b\u8d77\u6765\u65e0\u5904\u53ef\u53bb\u7684\u96f6\u6563\u4ee3\u7801\u4e4b\u95f4\u751f\u6210\u4e86\u5f88\u591a\u9690\u85cf\u7684\u8026\u5408\u5173\u7cfb\uff0c\u7ed3\u679c\u79ef\u7d2f\u4e86\u4e0d\u5c11\u6280\u672f\u503a\u3002\u73b0\u5728\u6211\u4eec\u5f88\u96be\u5355\u72ec\u7406\u89e3\u4ee3\u7801\u5e93\u4e2d\u67d0\u4e00\u90e8\u5206\u7684\u542b\u4e49\uff0c\u800c\u4e14\u6211\u4eec\u4e5f\u6ce8\u610f\u5230\u8d21\u732e\u8005\u4eec\u5f88\u5c11\u6709\u4fe1\u5fc3\u505a\u51fa\u7a81\u7834\u6027\u7684\u66f4\u6539\u3002\u901a\u8fc7\u91cd\u5199\uff0c\u6211\u4eec\u5f97\u4ee5\u57fa\u4e8e\u8fd9\u4e9b\u95ee\u9898\u91cd\u65b0\u601d\u8003\u4ee3\u7801\u7684\u7ec4\u7ec7\u65b9\u5f0f\u3002<\/p>\n<section style=\"text-align: center; font-size: 20px;\"><span style=\"height: 65px; line-height: 95px; color: #3c70c6; border-bottom: 2px solid #1b5fa0; background-image: url('http:\/\/www.zhushiyao.com\/wp-content\/uploads\/2020\/05\/3-1590743317.jpeg'); background-position: 50% 50%; background-repeat: no-repeat; background-attachment: initial; background-origin: initial; background-clip: initial; background-size: 92px; margin-top: 38px; margin-bottom: 10px; padding-bottom: 7px; display: inline-block;\">\u65e9\u671f\u7684\u539f\u578b\u9636\u6bb5<\/span><\/section>\n<p style=\"white-space: pre-line; padding-top: 23px; padding-right: 8px; padding-left: 8px; color: #4a4a4a; line-height: 1.75em;\">\u6211\u4eec\u662f\u4ece 2018 \u5e74\u672b\u5f00\u59cb\u521b\u5efa Vue 3 \u7684\u539f\u578b\u7684\uff0c\u4e3b\u8981\u76ee\u6807\u662f\u9a8c\u8bc1\u9488\u5bf9\u4e0a\u8ff0\u95ee\u9898\u7684\u89e3\u51b3\u65b9\u6848\u3002\u5728\u8fd9\u4e00\u9636\u6bb5\uff0c\u6211\u4eec\u4e3b\u8981\u662f\u4e3a\u540e\u7eed\u7684\u5f00\u53d1\u5de5\u4f5c\u6253\u4e0b\u7262\u56fa\u7684\u57fa\u7840\u3002<\/p>\n<section style=\"text-align: center;\"><span style=\"display: inline-block; height: 38px; line-height: 42px; color: #3c70c6; background-image: url('http:\/\/www.zhushiyao.com\/wp-content\/uploads\/2020\/05\/3-1590743317.jpeg'); background-position: left center; background-repeat: no-repeat; background-attachment: initial; background-origin: initial; background-clip: initial; background-size: 63px; padding-left: 35px; margin-top: 38px; margin-bottom: 10px;\">\u8f6c\u5411 TypeScript<\/span><\/section>\n<p style=\"white-space: pre-line; padding-top: 23px; padding-right: 8px; padding-left: 8px; color: #4a4a4a; line-height: 1.75em;\">Vue 2 \u6700\u521d\u662f\u7528\u7eaf\u7cb9\u7684 ES \u7f16\u5199\u7684\u3002\u539f\u578b\u9636\u6bb5\u5f00\u59cb\u540e\u4e0d\u4e45\uff0c\u6211\u4eec\u610f\u8bc6\u5230\u5bf9\u4e8e\u8fd9\u4e48\u5927\u89c4\u6a21\u7684\u9879\u76ee\u6765\u8bf4\uff0c\u7c7b\u578b\u7cfb\u7edf\u4f1a\u975e\u5e38\u6709\u7528\u3002\u7c7b\u578b\u68c0\u67e5\u53ef\u4ee5\u5927\u5e45\u964d\u4f4e\u5728\u91cd\u6784\u4e2d\u5f15\u5165\u610f\u5916 bug \u7684\u51e0\u7387\uff0c\u4e5f\u80fd\u63d0\u5347\u8d21\u732e\u8005\u5728\u505a\u51fa\u7a81\u7834\u6027\u66f4\u6539\u65f6\u7684\u4fe1\u5fc3\u3002\u6211\u4eec\u91c7\u7528\u4e86 Facebook \u7684 Flow \u7c7b\u578b\u68c0\u67e5\u5668\uff0c\u56e0\u4e3a\u5b83\u53ef\u4ee5\u6e10\u8fdb\u6dfb\u52a0\u5230\u4e00\u4e2a\u73b0\u6709\u7684\u7eaf ES \u9879\u76ee\u4e2d\u3002Flow \u8d77\u4e86\u4e00\u5b9a\u4f5c\u7528\uff0c\u4f46\u6211\u4eec\u7684\u6536\u76ca\u4e0d\u53ca\u9884\u671f\uff1b\u7279\u522b\u662f\u5b83\u7684\u91cd\u5927\u66f4\u6539\u592a\u591a\u4e86\uff0c\u5347\u7ea7\u8d77\u6765\u76f8\u5f53\u75db\u82e6\u3002\u5b83\u5bf9\u96c6\u6210\u5f00\u53d1\u73af\u5883\u7684\u652f\u6301\u4e5f\u4e0d\u5982 TypeScript \u4e0e VS Code \u7684\u6df1\u5ea6\u96c6\u6210\u6c34\u5e73\u3002<\/p>\n<p style=\"white-space: pre-line; padding-top: 23px; padding-right: 8px; padding-left: 8px; color: #4a4a4a; line-height: 1.75em;\">\u6211\u4eec\u8fd8\u6ce8\u610f\u5230\u8d8a\u6765\u8d8a\u591a\u7684\u7528\u6237\u5728\u7ed3\u5408\u4f7f\u7528 Vue \u548c TypeScript\u3002\u4e3a\u4e86\u652f\u6301\u4ed6\u4eec\u7684\u4f7f\u7528\u573a\u666f\uff0c\u6211\u4eec\u9700\u8981\u5728\u6e90\u7801\u4e4b\u5916\u5355\u72ec\u7f16\u5199\u548c\u7ef4\u62a4\u4e00\u5957 TypeScript \u58f0\u660e\uff0c\u5176\u4f7f\u7528\u4e86\u53e6\u4e00\u5957\u7c7b\u578b\u7cfb\u7edf\u3002\u8f6c\u5411 TypeScript \u540e\uff0c\u6211\u4eec\u5c31\u80fd\u81ea\u52a8\u751f\u6210\u58f0\u660e\u6587\u4ef6\uff0c\u964d\u4f4e\u7ef4\u62a4\u6210\u672c\u3002<\/p>\n<section style=\"text-align: center;\"><span style=\"display: inline-block; height: 38px; line-height: 42px; color: #3c70c6; background-image: url('http:\/\/www.zhushiyao.com\/wp-content\/uploads\/2020\/05\/3-1590743317.jpeg'); background-position: left center; background-repeat: no-repeat; background-attachment: initial; background-origin: initial; background-clip: initial; background-size: 63px; padding-left: 35px; margin-top: 38px; margin-bottom: 10px;\">\u89e3\u8026\u5185\u90e8\u5305<\/span><\/section>\n<p style=\"white-space: pre-line; padding-top: 23px; padding-right: 8px; padding-left: 8px; color: #4a4a4a; line-height: 1.75em;\">\u6211\u4eec\u8fd8\u91c7\u7528\u4e86\u4e00\u4e2a\u5355\u4f53\u4ed3\u5e93\u65b9\u6848\uff0c\u5176\u4e2d\u6846\u67b6\u662f\u7531\u4f17\u591a\u5185\u90e8\u5305\u7ec4\u6210\u7684\uff0c\u6bcf\u4e2a\u5305\u90fd\u6709\u81ea\u5df1\u72ec\u7acb\u7684 API\u3001\u7c7b\u578b\u5b9a\u4e49\u548c\u6d4b\u8bd5\u7528\u4f8b\u3002\u6211\u4eec\u60f3\u8ba9\u5404\u4e2a\u6a21\u5757\u95f4\u7684\u4f9d\u8d56\u5173\u7cfb\u66f4\u660e\u663e\uff0c\u8ba9\u5f00\u53d1\u4eba\u5458\u66f4\u5bb9\u6613\u9605\u8bfb\u3001\u7406\u89e3\u548c\u4fee\u6539\u6240\u6709\u8fd9\u4e9b\u4f9d\u8d56\u9879\u3002\u8fd9\u662f\u6211\u4eec\u964d\u4f4e\u9879\u76ee\u8d21\u732e\u95e8\u69db\uff0c\u63d0\u5347\u5176\u957f\u671f\u53ef\u7ef4\u62a4\u6027\u7684\u5173\u952e\u4e3e\u63aa\u3002<\/p>\n<section style=\"text-align: center;\"><span style=\"display: inline-block; height: 38px; line-height: 42px; color: #3c70c6; background-image: url('http:\/\/www.zhushiyao.com\/wp-content\/uploads\/2020\/05\/3-1590743317.jpeg'); background-position: left center; background-repeat: no-repeat; background-attachment: initial; background-origin: initial; background-clip: initial; background-size: 63px; padding-left: 35px; margin-top: 38px; margin-bottom: 10px;\">\u5236\u5b9a RFC \u6d41\u7a0b<\/span><\/section>\n<p style=\"white-space: pre-line; padding-top: 23px; padding-right: 8px; padding-left: 8px; color: #4a4a4a; line-height: 1.75em;\">2018 \u5e74\u672b\uff0c\u6211\u4eec\u6709\u4e86\u4e00\u4e2a\u5e26\u6709\u65b0\u7684\u54cd\u5e94\u7cfb\u7edf\u548c\u865a\u62df DOM \u6e32\u67d3\u5668\u7684\u539f\u578b\u3002\u6211\u4eec\u9a8c\u8bc1\u4e86\u8ba1\u5212\u4e2d\u7684\u5185\u90e8\u67b6\u6784\u4f18\u5316\uff0c\u4f46\u53ea\u662f\u7c97\u7565\u8d77\u8349\u4e86\u9762\u5411\u5916\u90e8\u7684 API \u66f4\u6539\u60f3\u6cd5\u3002\u73b0\u5728\u8be5\u5c06\u8fd9\u4e9b\u60f3\u6cd5\u8f6c\u53d8\u4e3a\u5177\u4f53\u7684\u8bbe\u8ba1\u4e86\u3002<\/p>\n<p style=\"white-space: pre-line; padding-top: 23px; padding-right: 8px; padding-left: 8px; color: #4a4a4a; line-height: 1.75em;\">\u6211\u4eec\u77e5\u9053\u8fd9\u4e00\u6b65\u8981\u5728\u65e9\u671f\u8c28\u614e\u8fdb\u884c\u3002Vue \u7684\u5e7f\u6cdb\u6d41\u884c\u610f\u5473\u7740\u91cd\u5927\u66f4\u6539\u53ef\u80fd\u4f1a\u7ed9\u7528\u6237\u5e26\u6765\u5de8\u5927\u7684\u8fc1\u79fb\u6210\u672c\uff0c\u8fd8\u53ef\u80fd\u8ba9\u751f\u6001\u788e\u7247\u5316\u3002\u4e3a\u4e86\u8ba9\u7528\u6237\u5bf9\u91cd\u5927\u66f4\u6539\u63d0\u4ea4\u53cd\u9988\uff0c\u6211\u4eec\u5728 2019 \u5e74\u521d\u5236\u5b9a\u4e86\u4e00\u5957 RFC\uff08\u5f81\u6c42\u610f\u89c1\uff09\u6d41\u7a0b\u3002<\/p>\n<p style=\"white-space: pre-line; padding-top: 23px; padding-right: 8px; padding-left: 8px; color: #4a4a4a; line-height: 1.75em;\"><span style=\"color: #888888; font-size: 14px;\">https:\/\/github.com\/vuejs\/rfcs<\/span><\/p>\n<p style=\"white-space: pre-line; padding-top: 23px; padding-right: 8px; padding-left: 8px; color: #4a4a4a; line-height: 1.75em;\">\u6240\u6709 RFC \u90fd\u6709\u4e00\u4e2a\u6a21\u677f\uff0c\u5305\u62ec\u52a8\u673a\u3001\u8bbe\u8ba1\u7ec6\u8282\u3001\u6743\u8861\u4ee5\u53ca\u91c7\u7528\u7b56\u7565\u7b49\u5185\u5bb9\u3002\u8fd9\u5957\u6d41\u7a0b\u7684\u5b9e\u73b0\u5f62\u5f0f\uff0c\u662f\u5728\u4e00\u4e2a Github \u4ed3\u5e93\u4e0a\u5c06\u63d0\u6848\u63d0\u4ea4\u6210\u62c9\u53d6\u8bf7\u6c42\uff0c\u8fd9\u6837\u81ea\u7136\u5c31\u53ef\u4ee5\u5728\u8bc4\u8bba\u4e2d\u8ba8\u8bba\u63d0\u6848\u4e86\u3002<\/p>\n<p style=\"white-space: pre-line; padding-top: 23px; padding-right: 8px; padding-left: 8px; color: #4a4a4a; line-height: 1.75em;\">\u7ed3\u679c\u8868\u660e\u8fd9\u4e2a RFC \u6d41\u7a0b\u975e\u5e38\u6709\u7528\u3002\u4f5c\u4e3a\u4e00\u4e2a\u601d\u7ef4\u6846\u67b6\uff0c\u5b83\u5f3a\u5236\u6211\u4eec\u5168\u9762\u8003\u8651\u4e00\u4e2a\u6f5c\u5728\u66f4\u6539\u7684\u6240\u6709\u5c42\u9762\uff0c\u5e76\u8ba9\u6574\u4e2a\u793e\u533a\u53ef\u4ee5\u53c2\u4e0e\u5230\u8bbe\u8ba1\u8fc7\u7a0b\u4e2d\uff0c\u5e76\u63d0\u4ea4\u7ecf\u8fc7\u5145\u5206\u601d\u8003\u7684\u7279\u6027\u9700\u6c42\u3002<\/p>\n<section style=\"text-align: center; font-size: 20px;\"><span style=\"height: 65px; line-height: 95px; color: #3c70c6; border-bottom: 2px solid #1b5fa0; background-image: url('http:\/\/www.zhushiyao.com\/wp-content\/uploads\/2020\/05\/3-1590743317.jpeg'); background-position: 50% 50%; background-repeat: no-repeat; background-attachment: initial; background-origin: initial; background-clip: initial; background-size: 92px; margin-top: 38px; margin-bottom: 10px; padding-bottom: 7px; display: inline-block;\">\u66f4\u5feb\uff0c\u66f4\u5c0f<\/span><\/section>\n<blockquote style=\"margin-top: 0px; margin-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: none;\">\n<p style=\"font-size: 16px; white-space: pre-line; line-height: 1.75em; margin-top: 27px; padding-right: 20px; padding-left: 20px; color: #5baceb;\">\u524d\u7aef\u6846\u67b6\u7684\u6027\u80fd\u81f3\u5173\u91cd\u8981\u3002<\/p>\n<\/blockquote>\n<p style=\"white-space: pre-line; padding-top: 23px; padding-right: 8px; padding-left: 8px; color: #4a4a4a; line-height: 1.75em;\">\u524d\u7aef\u6846\u67b6\u7684\u6027\u80fd\u81f3\u5173\u91cd\u8981\u3002\u5c3d\u7ba1 Vue 2 \u5df2\u7ecf\u63d0\u4f9b\u4e86\u9887\u5177\u7ade\u4e89\u529b\u7684\u6027\u80fd\u8868\u73b0\uff0c\u4f46\u8fd9\u6b21\u91cd\u5199\u8ba9\u6211\u4eec\u6709\u673a\u4f1a\u8bd5\u9a8c\u65b0\u7684\u6e32\u67d3\u7b56\u7565\u6765\u8fdb\u4e00\u6b65\u63d0\u5347\u6027\u80fd\u3002<\/p>\n<section style=\"text-align: center;\"><span style=\"display: inline-block; height: 38px; line-height: 42px; color: #3c70c6; background-image: url('http:\/\/www.zhushiyao.com\/wp-content\/uploads\/2020\/05\/3-1590743317.jpeg'); background-position: left center; background-repeat: no-repeat; background-attachment: initial; background-origin: initial; background-clip: initial; background-size: 63px; padding-left: 35px; margin-top: 38px; margin-bottom: 10px;\">\u7a81\u7834\u865a\u62df DOM \u7684\u74f6\u9888<\/span><\/section>\n<p style=\"white-space: pre-line; padding-top: 23px; padding-right: 8px; padding-left: 8px; color: #4a4a4a; line-height: 1.75em;\">Vue \u6709\u4e00\u5957\u72ec\u7279\u7684\u6e32\u67d3\u7b56\u7565\uff1a\u5b83\u63d0\u4f9b\u4e86\u4e00\u4e2a\u7c7b HTML \u7684\u6a21\u677f\u8bed\u6cd5\uff0c\u4f46\u5c06\u6a21\u677f\u7f16\u8bd1\u6210\u4e86\u4e00\u4e2a\u8fd4\u56de\u865a\u62df DOM \u6811\u7684\u6e32\u67d3\u51fd\u6570\u3002\u6846\u67b6\u4f1a\u9012\u5f52\u904d\u5386\u4e24\u4e2a\u865a\u62df DOM \u6811\uff0c\u5bf9\u6bd4\u6bcf\u4e2a\u8282\u70b9\u7684\u6240\u6709\u5c5e\u6027\u6765\u5224\u65ad\u8be5\u66f4\u65b0 DOM \u7684\u54ea\u4e9b\u90e8\u5206\u3002\u8fd9\u79cd\u76f8\u5bf9\u66b4\u529b\u7684\u7b97\u6cd5\u4e00\u822c\u8fd8\u662f\u5f88\u5feb\u7684\uff0c\u8fd9\u8981\u611f\u8c22\u73b0\u4ee3 JS \u5f15\u64ce\u5b9e\u73b0\u7684\u90a3\u4e48\u591a\u9ad8\u7ea7\u4f18\u5316\u63aa\u65bd\u3002\u4f46\u662f\u66f4\u65b0\u8fc7\u7a0b\u8fd8\u662f\u4f1a\u6d89\u53ca\u5f88\u591a\u4e0d\u5fc5\u8981\u7684 CPU \u5de5\u4f5c\u3002\u5f53\u4f60\u7684\u6a21\u677f\u5b58\u5728\u5927\u91cf\u9759\u6001\u5185\u5bb9\uff0c\u5374\u53ea\u6709\u5c11\u91cf\u52a8\u6001\u7ed1\u5b9a\u65f6\uff0c\u66f4\u65b0\u7684\u6548\u7387\u5c31\u4f1a\u663e\u5f97\u5c24\u4e3a\u4f4e\u4e0b\u2014\u2014\u8fd8\u662f\u8981\u9012\u5f52\u904d\u5386\u6574\u4e2a\u865a\u62df DOM \u6811\uff0c\u624d\u80fd\u627e\u51fa\u8981\u66f4\u65b0\u7684\u90e8\u5206\u3002<\/p>\n<p style=\"white-space: pre-line; padding-top: 23px; padding-right: 8px; padding-left: 8px; color: #4a4a4a; line-height: 1.75em;\">\u6240\u5e78\u6a21\u677f\u7f16\u8bd1\u8fd9\u4e00\u6b65\u8ba9\u6211\u4eec\u53ef\u4ee5\u5bf9\u6a21\u677f\u8fdb\u884c\u9759\u6001\u5206\u6790\uff0c\u5e76\u63d0\u53d6\u52a8\u6001\u90e8\u5206\u7684\u4fe1\u606f\u3002Vue 2 \u8df3\u8fc7\u4e86\u9759\u6001\u5b50\u6811\uff0c\u5728\u4e00\u5b9a\u7a0b\u5ea6\u4e0a\u505a\u5230\u4e86\u8fd9\u4e00\u70b9\uff1b\u4f46\u662f\u7531\u4e8e\u8fc7\u5ea6\u7b80\u5316\u7684\u7f16\u8bd1\u5668\u67b6\u6784\uff0c\u66f4\u9ad8\u7ea7\u7684\u4f18\u5316\u5c31\u5f88\u96be\u5b9e\u73b0\u4e86\u3002\u5728 Vue 3 \u4e2d\u6211\u4eec\u91cd\u5199\u4e86\u7f16\u8bd1\u5668\uff0c\u52a0\u5165\u4e86\u4e00\u4e2a\u5408\u9002\u7684 AST transform \u7ba1\u9053\uff0c\u8ba9\u6211\u4eec\u80fd\u4ee5 transform \u63d2\u4ef6\u7684\u5f62\u5f0f\u8fdb\u884c\u7f16\u8bd1\u65f6\u4f18\u5316\u3002<\/p>\n<p style=\"white-space: pre-line; padding-top: 23px; padding-right: 8px; padding-left: 8px; color: #4a4a4a; line-height: 1.75em;\">\u73b0\u5728\u6709\u4e86\u65b0\u7684\u67b6\u6784\uff0c\u6211\u4eec\u60f3\u8981\u627e\u5230\u4e00\u4e2a\u5c3d\u53ef\u80fd\u51cf\u5c11\u989d\u5916\u5f00\u9500\u7684\u6e32\u67d3\u7b56\u7565\u3002\u4e00\u4e2a\u9009\u9879\u662f\u629b\u5f03\u865a\u62df DOM \u5e76\u76f4\u63a5\u751f\u6210\u547d\u4ee4\u5f0f DOM \u64cd\u4f5c\uff0c\u4f46\u8fd9\u4f1a\u5931\u53bb\u76f4\u63a5\u7f16\u5199\u865a\u62df DOM \u6e32\u67d3\u51fd\u6570\u7684\u80fd\u529b\uff0c\u6211\u4eec\u53d1\u73b0\u8fd9\u662f\u5bf9\u4e8e\u9ad8\u7ea7\u7528\u6237\u548c\u5e93\u4f5c\u8005\u4eec\u975e\u5e38\u6709\u4ef7\u503c\u7684\u80fd\u529b\u3002\u6b64\u5916\uff0c\u8fd9\u4e5f\u4f1a\u662f\u4e00\u4e2a\u5f71\u54cd\u5de8\u5927\u7684\u91cd\u5927\u66f4\u6539\u3002<\/p>\n<p style=\"white-space: pre-line; padding-top: 23px; padding-right: 8px; padding-left: 8px; color: #4a4a4a; line-height: 1.75em;\">\u63a5\u4e0b\u6765\u7684\u9009\u9879\u5c31\u662f\u6446\u8131\u4e0d\u5fc5\u8981\u7684\u865a\u62df DOM \u6811\u904d\u5386\u548c\u5c5e\u6027\u5bf9\u6bd4\uff0c\u8fd9\u4e5f\u662f\u66f4\u65b0\u8fc7\u7a0b\u4e2d\u6027\u80fd\u5f00\u9500\u6700\u5927\u7684\u90e8\u5206\u3002\u4e3a\u6b64\uff0c\u7f16\u8bd1\u5668\u548c\u8fd0\u884c\u65f6\u9700\u8981\u534f\u540c\u5de5\u4f5c\uff1a\u7f16\u8bd1\u5668\u5206\u6790\u6a21\u677f\uff0c\u751f\u6210\u5e26\u6709\u4f18\u5316\u7ebf\u7d22\u7684\u4ee3\u7801\uff0c\u800c\u8fd0\u884c\u65f6\u83b7\u53d6\u7ebf\u7d22\u5e76\u9009\u62e9\u6700\u5feb\u8def\u5f84\u3002\u8fd9\u91cc\u6709\u4e09\u5927\u4f18\u5316\u5de5\u4f5c\uff1a<\/p>\n<p style=\"white-space: pre-line; padding-top: 23px; padding-right: 8px; padding-left: 8px; color: #4a4a4a; line-height: 1.75em;\">\u9996\u5148\uff0c\u5728\u6811\u7ea7\u522b\uff0c\u6211\u4eec\u6ce8\u610f\u5230\u6ca1\u6709\u52a8\u6001\u8c03\u6574\u8282\u70b9\u7ed3\u6784\u7684\u6a21\u677f\u6307\u4ee4\uff08\u5982 v-if \u548c v-for\uff09\u65f6\uff0c\u8282\u70b9\u7684\u7ed3\u6784\u5b8c\u5168\u4fdd\u6301\u9759\u6001\u3002\u5982\u679c\u6211\u4eec\u5c06\u6a21\u677f\u6839\u636e\u8fd9\u4e9b\u7ed3\u6784\u5316\u6307\u4ee4\u62c6\u5206\u4e3a\u4e00\u4e9b\u5d4c\u5957&#8221;\u5757&#8221;\uff0c\u6bcf\u4e00\u4e2a\u5757\u4e2d\u7684\u8282\u70b9\u7ed3\u6784\u4e5f\u4f1a\u4fdd\u6301\u9759\u6001\u3002\u5f53\u6211\u4eec\u66f4\u65b0\u4e00\u4e2a\u5757\u4e2d\u7684\u8282\u70b9\u65f6\uff0c\u5c31\u4e0d\u5fc5\u518d\u9012\u5f52\u904d\u5386\u6574\u4e2a\u6811\u4e86\u2014\u2014\u5757\u5185\u7684\u52a8\u6001\u7ed1\u5b9a\u53ef\u4ee5\u5728\u4e00\u4e2a\u5e73\u9762\u6570\u7ec4\u91cc\u8ffd\u8e2a\u3002\u8fd9\u4e00\u4f18\u5316\u6781\u5927\u51cf\u5c11\u4e86\u9700\u8981\u904d\u5386\u7684\u6811\u7684\u6570\u91cf\uff0c\u89c4\u907f\u4e86\u5927\u90e8\u5206\u865a\u62df DOM \u6811\u5f00\u9500\u3002<\/p>\n<p style=\"white-space: pre-line; padding-top: 23px; padding-right: 8px; padding-left: 8px; color: #4a4a4a; line-height: 1.75em;\">\u5176\u6b21\uff0c\u7f16\u8bd1\u5668\u4f1a\u6fc0\u8fdb\u68c0\u6d4b\u6a21\u677f\u4e2d\u7684\u9759\u6001\u8282\u70b9\u3001\u5b50\u6811\u751a\u81f3\u6570\u636e\u5bf9\u8c61\uff0c\u5e76\u5728\u751f\u6210\u7684\u4ee3\u7801\u4e2d\u5c06\u5b83\u4eec\u63d0\u53d6\u5230\u6e32\u67d3\u51fd\u6570\u4e4b\u5916\u3002\u8fd9\u5c31\u53ef\u4ee5\u907f\u514d\u5728\u6bcf\u6b21\u6e32\u67d3\u65f6\u91cd\u65b0\u521b\u5efa\u8fd9\u4e9b\u5bf9\u8c61\uff0c\u5927\u5e45\u51cf\u5c11\u4e86\u5185\u5b58\u5360\u7528\uff0c\u5e76\u51cf\u5c11\u4e86\u5783\u573e\u6536\u96c6\u7684\u9891\u7387\u3002<\/p>\n<p style=\"white-space: pre-line; padding-top: 23px; padding-right: 8px; padding-left: 8px; color: #4a4a4a; line-height: 1.75em;\">\u6700\u540e\uff0c\u5728\u5143\u7d20\u7ea7\u522b\uff0c\u7f16\u8bd1\u5668\u4f1a\u4e3a\u6bcf\u4e00\u4e2a\u6709\u52a8\u6001\u7ed1\u5b9a\u7684\u5143\u7d20\uff0c\u6839\u636e\u5176\u9700\u8981\u8fdb\u884c\u7684\u66f4\u65b0\u7c7b\u578b\u751f\u6210\u4e00\u4e2a\u4f18\u5316\u6807\u5fd7\u3002\u6bd4\u5982\u8bf4\u4e00\u4e2a\u5143\u7d20\u6709\u4e00\u4e2a\u52a8\u6001\u7684 class \u7ed1\u5b9a\u548c\u4e00\u4e9b\u9759\u6001\u5c5e\u6027\uff0c\u5b83\u4f1a\u83b7\u5f97\u4e00\u4e2a\u6807\u5fd7\uff0c\u8868\u793a\u8fd9\u91cc\u53ea\u9700\u8981\u8fdb\u884c class \u68c0\u67e5\u3002\u8fd0\u884c\u65f6\u4f1a\u83b7\u53d6\u8fd9\u4e9b\u6807\u5fd7\uff0c\u7136\u540e\u9009\u62e9\u6700\u5feb\u7684\u8def\u5f84\u3002<\/p>\n<blockquote style=\"margin-top: 0px; margin-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: none;\">\n<p style=\"font-size: 16px; white-space: pre-line; line-height: 1.75em; margin-top: 27px; padding-right: 20px; padding-left: 20px; color: #5baceb;\"><strong style=\"text-align: left;\">CPU \u65f6\u95f4<\/strong>\uff1a\u662f\u6307 JavaScript \u8fd0\u7b97\u6240\u6d88\u8017\u7684\u65f6\u95f4\uff0c\u4e0d\u5305\u62ec\u6d4f\u89c8\u5668 DOM \u64cd\u4f5c\u6240\u7528\u7684\u65f6\u95f4\u3002<\/p>\n<\/blockquote>\n<p style=\"white-space: pre-line; padding-top: 23px; padding-right: 8px; padding-left: 8px; color: #4a4a4a; line-height: 1.75em;\">\u7ed3\u5408\u8fd9\u4e9b\u4f18\u5316\uff0c\u6211\u4eec\u7684\u6e32\u67d3\u66f4\u65b0\u901f\u5ea6\u83b7\u5f97\u4e86\u663e\u8457\u6539\u8fdb\uff0c\u5728\u67d0\u4e9b\u573a\u666f\u4e0b Vue 3 \u7684 <strong style=\"text-align: left;\">CPU \u65f6\u95f4<\/strong> \u4ec5\u4e3a Vue 2 \u7684\u5341\u5206\u4e4b\u4e00\u4e0d\u5230\u3002<\/p>\n<section style=\"text-align: center;\"><span style=\"display: inline-block; height: 38px; line-height: 42px; color: #3c70c6; background-image: url('http:\/\/www.zhushiyao.com\/wp-content\/uploads\/2020\/05\/3-1590743317.jpeg'); background-position: left center; background-repeat: no-repeat; background-attachment: initial; background-origin: initial; background-clip: initial; background-size: 63px; padding-left: 35px; margin-top: 38px; margin-bottom: 10px;\">\u7f29\u5c0f\u5305\u4f53\u79ef<\/span><\/section>\n<p style=\"white-space: pre-line; padding-top: 23px; padding-right: 8px; padding-left: 8px; color: #4a4a4a; line-height: 1.75em;\">\u6846\u67b6\u7684\u5927\u5c0f\u4e5f\u4f1a\u5f71\u54cd\u5176\u6027\u80fd\u3002\u8fd9\u662f Web \u5e94\u7528\u7a0b\u5e8f\u7279\u6709\u7684\u73b0\u8c61\uff0c\u56e0\u4e3a\u8d44\u4ea7\u9700\u8981\u5728\u7ebf\u4e0b\u8f7d\uff0c\u800c\u5e94\u7528\u9700\u8981\u7b49\u5230\u6d4f\u89c8\u5668\u89e3\u6790\u5b8c\u5fc5\u8981\u7684 JavaScript \u4ee3\u7801\u540e\u624d\u80fd\u5f00\u59cb\u4ea4\u4e92\u3002\u5355\u9875\u9762\u5e94\u7528\u7a0b\u5e8f\u5728\u8fd9\u65b9\u9762\u7684\u77db\u76fe\u5c24\u4e3a\u660e\u663e\u3002\u5c3d\u7ba1 Vue \u4e00\u76f4\u4ee5\u6765\u90fd\u662f\u76f8\u5bf9\u8f7b\u91cf\u7ea7\u7684\u6846\u67b6\u2014\u2014Vue 2 \u7684\u8fd0\u884c\u65f6\u5927\u5c0f\u4e3a 23KB\uff08gzip \u538b\u7f29\u540e\uff09\uff0c\u6211\u4eec\u8fd8\u662f\u6ce8\u610f\u5230\u4e86\u4e24\u4e2a\u95ee\u9898\uff1a<\/p>\n<p style=\"white-space: pre-line; padding-top: 23px; padding-right: 8px; padding-left: 8px; color: #4a4a4a; line-height: 1.75em;\">\u9996\u5148\uff0c\u4e0d\u662f\u6240\u6709\u4eba\u90fd\u9700\u8981\u6846\u67b6\u7684\u5168\u90e8\u529f\u80fd\u3002\u4f8b\u5982\uff0c\u4ece\u6765\u4e0d\u9700\u8981\u8fc7\u6e21\u7279\u6027\u7684\u5e94\u7528\u8fd8\u662f\u9700\u8981\u4e0b\u8f7d\u548c\u89e3\u6790\u76f8\u5173\u4ee3\u7801\u3002<\/p>\n<p style=\"white-space: pre-line; padding-top: 23px; padding-right: 8px; padding-left: 8px; color: #4a4a4a; line-height: 1.75em;\">\u53e6\u5916\uff0c\u6211\u4eec\u5728\u4e0d\u65ad\u7ed9\u6846\u67b6\u589e\u52a0\u65b0\u7279\u6027\uff0c\u6846\u67b6\u4e5f\u5728\u4e0d\u65ad\u53d8\u5927\uff0c\u6ca1\u6709\u6b62\u5883\u3002\u8fd9\u6837\u6211\u4eec\u5728\u6743\u8861\u65b0\u7279\u6027\u7684\u5229\u5f0a\u65f6\uff0c\u5c31\u5f97\u975e\u5e38\u5728\u610f\u5305\u5927\u5c0f\u8fd9\u4e2a\u6743\u91cd\u3002\u7ed3\u679c\uff0c\u6211\u4eec\u4f1a\u503e\u5411\u4e8e\u53ea\u52a0\u5165\u90a3\u4e9b\u5927\u591a\u6570\u7528\u6237\u90fd\u4f1a\u7528\u5230\u7684\u7279\u6027\u3002<\/p>\n<p style=\"white-space: pre-line; padding-top: 23px; padding-right: 8px; padding-left: 8px; color: #4a4a4a; line-height: 1.75em;\">\u7406\u60f3\u72b6\u6001\u4e0b\uff0c\u7528\u6237\u53ef\u4ee5\u5728\u6784\u5efa\u65f6\u53bb\u6389\u6846\u67b6\u4e2d\u81ea\u5df1\u4e0d\u9700\u8981\u7684\u7279\u6027\uff08\u4e5f\u5c31\u662f&#8221;\u6447\u6811\u4f18\u5316&#8221;\uff09\uff0c\u53ea\u4fdd\u7559\u81ea\u5df1\u7528\u5230\u7684\u7279\u6027\u3002\u8fd9\u6837\u6211\u4eec\u5728\u6dfb\u52a0\u53ea\u6709\u90e8\u5206\u7528\u6237\u4f1a\u7528\u5230\u7684\u7279\u6027\u65f6\uff0c\u5e76\u4e0d\u4f1a\u7ed9\u5176\u4ed6\u7528\u6237\u589e\u6dfb\u5e94\u7528\u4f53\u79ef\u7684\u8d1f\u62c5\u3002<\/p>\n<p style=\"white-space: pre-line; padding-top: 23px; padding-right: 8px; padding-left: 8px; color: #4a4a4a; line-height: 1.75em;\">\u5728 Vue 3 \u4e2d\uff0c\u6211\u4eec\u628a\u5927\u591a\u6570\u5168\u5c40 API \u548c\u5185\u90e8 helper \u79fb\u5230\u4e86 ES \u6a21\u5757\u5bfc\u51fa\u4e2d\uff0c\u4ece\u800c\u5b9e\u73b0\u4e86\u8fd9\u4e2a\u76ee\u6807\u3002\u8fd9\u6837\u73b0\u4ee3\u7684\u6253\u5305\u5668\u5c31\u53ef\u4ee5\u9759\u6001\u5206\u6790\u6a21\u5757\u4f9d\u8d56\u9879\uff0c\u5e76\u53bb\u6389\u4e0e\u672a\u4f7f\u7528\u5bfc\u51fa\u76f8\u5173\u7684\u4ee3\u7801\u3002\u6a21\u677f\u7f16\u8bd1\u5668\u4e5f\u4f1a\u751f\u6210\u9002\u5408\u6447\u6811\u4f18\u5316\u7684\u4ee3\u7801\uff0c\u53ea\u4f1a\u5bf9\u6a21\u677f\u786e\u5b9e\u7528\u5230\u7684\u7279\u6027\u5bfc\u5165 helper\u3002<\/p>\n<p style=\"white-space: pre-line; padding-top: 23px; padding-right: 8px; padding-left: 8px; color: #4a4a4a; line-height: 1.75em;\">\u6846\u67b6\u7684\u6709\u4e9b\u90e8\u5206\u662f\u6c38\u8fdc\u65e0\u6cd5\u6447\u6811\u4f18\u5316\u7684\uff0c\u56e0\u4e3a\u5b83\u4eec\u5bf9\u4e8e\u6240\u6709\u5e94\u7528\u7c7b\u578b\u6765\u8bf4\u90fd\u5f88\u91cd\u8981\u3002\u6211\u4eec\u5c06\u8fd9\u90e8\u5206\u65e0\u6cd5\u820d\u5f03\u7684\u4ee3\u7801\u7684\u4f53\u79ef\u79f0\u4f5c\u57fa\u7ebf\u5927\u5c0f\u3002\u867d\u7136 Vue 3 \u589e\u52a0\u4e86\u5f88\u591a\u65b0\u7279\u6027\uff0c\u4f46\u5176\u57fa\u7ebf\u5927\u5c0f\u53ea\u6709\u5927\u7ea6 10KB\uff08gzip \u540e\uff09\uff0c\u4e0d\u5230 Vue 2 \u7684\u4e00\u534a\u3002<\/p>\n<section style=\"text-align: center; font-size: 20px;\"><span style=\"height: 65px; line-height: 95px; color: #3c70c6; border-bottom: 2px solid #1b5fa0; background-image: url('http:\/\/www.zhushiyao.com\/wp-content\/uploads\/2020\/05\/3-1590743317.jpeg'); background-position: 50% 50%; background-repeat: no-repeat; background-attachment: initial; background-origin: initial; background-clip: initial; background-size: 92px; margin-top: 38px; margin-bottom: 10px; padding-bottom: 7px; display: inline-block;\">\u6ee1\u8db3\u6269\u5c55\u9700\u6c42<\/span><\/section>\n<p style=\"white-space: pre-line; padding-top: 23px; padding-right: 8px; padding-left: 8px; color: #4a4a4a; line-height: 1.75em;\">\u6211\u4eec\u8fd8\u60f3\u6539\u5584 Vue \u5e94\u5bf9\u5927\u89c4\u6a21\u5e94\u7528\u7a0b\u5e8f\u7684\u80fd\u529b\u3002\u6211\u4eec\u6700\u521d\u8bbe\u8ba1 Vue \u65f6\u4e3b\u8981\u60f3\u7684\u662f\u964d\u4f4e\u5165\u95e8\u95e8\u69db\u5e76\u5e73\u6ed1\u5b66\u4e60\u66f2\u7ebf\u3002\u4f46\u968f\u7740 Vue \u6108\u52a0\u6d41\u884c\uff0c\u6211\u4eec\u4e5f\u770b\u5230\u4e86\u8d8a\u6765\u8d8a\u591a\u7684\u9879\u76ee\u9700\u6c42\u968f\u7740\u65f6\u95f4\u63a8\u79fb\u4e0d\u65ad\u6269\u5927\uff0c\u540e\u671f\u751a\u81f3\u5305\u542b\u6570\u4ee5\u767e\u8ba1\u7684\u6a21\u5757\uff0c\u9700\u8981\u51e0\u5341\u540d\u5f00\u53d1\u4eba\u5458\u6765\u7ef4\u62a4\u3002\u5bf9\u4e8e\u8fd9\u79cd\u7c7b\u578b\u7684\u9879\u76ee\uff0cTypeScript \u8fd9\u6837\u7684\u7c7b\u578b\u7cfb\u7edf\u548c\u53ef\u4ee5\u63d0\u4f9b\u7ec4\u7ec7\u6e05\u6670\u3001\u6613\u4e8e\u590d\u7528\u7684\u4ee3\u7801\u7684\u80fd\u529b\u662f\u5fc5\u4e0d\u53ef\u5c11\u7684\uff0c\u4f46 Vue 2 \u5728\u8fd9\u4e9b\u65b9\u9762\u7684\u652f\u6301\u6c34\u5e73\u4e0d\u751a\u7406\u60f3\u3002<\/p>\n<p style=\"white-space: pre-line; padding-top: 23px; padding-right: 8px; padding-left: 8px; color: #4a4a4a; line-height: 1.75em;\">\u5728 Vue 3 \u7684\u65e9\u671f\u8bbe\u8ba1\u9636\u6bb5\uff0c\u6211\u4eec\u5c1d\u8bd5\u5185\u7f6e\u5bf9\u4f7f\u7528 class \u7f16\u5199\u7ec4\u4ef6\u7684\u652f\u6301\uff0c\u4ece\u800c\u66f4\u597d\u5730\u6574\u5408 TypeScript\u3002\u8fd9\u91cc\u7684\u95ee\u9898\u5728\u4e8e\uff0c\u4e3a\u4e86\u8ba9 class \u53ef\u7528\u800c\u9700\u8981\u7684\u5f88\u591a\u8bed\u8a00\u7279\u6027\uff08\u4f8b\u5982 class fields \u548c decorators\uff09\u90fd\u8fd8\u5904\u5728\u63d0\u6848\u9636\u6bb5\uff0c\u6709\u53ef\u80fd\u5728\u6b63\u5f0f\u7248\u4e2d\u51fa\u73b0\u53d8\u5316\u3002\u968f\u4e4b\u800c\u6765\u7684\u590d\u6742\u6027\u548c\u4e0d\u786e\u5b9a\u6027\u8ba9\u6211\u4eec\u5f00\u59cb\u8d28\u7591 Class API \u662f\u5426\u771f\u7684\u5408\u9002\uff0c\u56e0\u4e3a\u5b83\u53ea\u80fd\u6539\u5584\u4e00\u70b9 TypeScript \u7684\u6574\u5408\u80fd\u529b\u800c\u5df2\u3002<\/p>\n<p style=\"white-space: pre-line; padding-top: 23px; padding-right: 8px; padding-left: 8px; color: #4a4a4a; line-height: 1.75em;\">\u4e8e\u662f\u6211\u4eec\u51b3\u5b9a\u63a2\u7d22\u5176\u4ed6\u9014\u5f84\u6765\u89e3\u51b3\u6269\u5c55\u95ee\u9898\u3002\u53d7\u5230 React Hooks \u7684\u542f\u53d1\uff0c\u6211\u4eec\u60f3\u5230\u4e86\u66b4\u9732\u5e95\u5c42\u7684\u54cd\u5e94\u5f0f\u548c\u7ec4\u4ef6\u751f\u547d\u5468\u671f\u7684 API\uff0c\u4ece\u800c\u63d0\u4f9b\u4e00\u79cd\u66f4\u7075\u6d3b\u5730\u7f16\u5199\u7ec4\u4ef6\u903b\u8f91\u7684\u65b9\u5f0f\uff0c\u4e5f\u5c31\u662f Composition API\u3002<\/p>\n<p style=\"white-space: pre-line; padding-top: 23px; padding-right: 8px; padding-left: 8px; color: #4a4a4a; line-height: 1.75em;\"><span style=\"color: #888888; font-size: 14px;\">https:\/\/vue-composition-api-rfc.netlify.com\/<\/span><\/p>\n<p style=\"white-space: pre-line; padding-top: 23px; padding-right: 8px; padding-left: 8px; color: #4a4a4a; line-height: 1.75em;\">Composition API \u4e0d\u518d\u9700\u8981\u7528\u4e00\u4e2a\u957f\u957f\u7684\u914d\u7f6e\u5217\u8868\u5b9a\u4e49\u7ec4\u4ef6\uff0c\u5b83\u5141\u8bb8\u7528\u6237\u81ea\u7531\u5b9a\u4e49\u3001\u7ec4\u5408\u548c\u91cd\u7528\u7ec4\u4ef6\u903b\u8f91\uff0c\u5c31\u50cf\u5199\u51fd\u6570\u4e00\u6837\uff0c\u540c\u65f6\u8fd8\u80fd\u63d0\u4f9b\u5b8c\u5584\u7684 TypeScript \u652f\u6301\u3002<\/p>\n<p style=\"white-space: pre-line; padding-top: 23px; padding-right: 8px; padding-left: 8px; color: #4a4a4a; line-height: 1.75em;\">\u6211\u4eec\u975e\u5e38\u559c\u6b22\u8fd9\u4e2a\u60f3\u6cd5\u3002\u5c3d\u7ba1 Composition API \u662f\u4e3a\u89e3\u51b3\u7279\u5b9a\u7c7b\u578b\u7684\u95ee\u9898\u8bbe\u8ba1\u7684\uff0c\u4f46\u4e5f\u80fd\u7528\u5728\u5355\u7eaf\u7684\u7ec4\u4ef6\u5f00\u53d1\u4e2d\u3002\u5728\u63d0\u6848\u7684\u521d\u7a3f\u4e2d\u6211\u4eec\u6709\u4e9b\u5fd8\u4e4e\u6240\u4ee5\uff0c\u6697\u793a\u6211\u4eec\u53ef\u80fd\u4f1a\u5728\u672a\u6765\u7684\u7248\u672c\u4e2d\u7528 Composition API \u66ff\u6362\u6389\u5f53\u524d\u7684 Options API\u3002\u8fd9\u5f15\u8d77\u4e86\u793e\u533a\u6210\u5458\u7684\u6781\u5927\u53cd\u5f39\uff0c\u7ed9\u6211\u4eec\u4e0a\u4e86\u91cd\u8981\u7684\u4e00\u8bfe\uff0c\u8ba9\u6211\u4eec\u8ba4\u8bc6\u5230\u4e86\u4e0e\u793e\u533a\u6c9f\u901a\u957f\u671f\u8ba1\u5212\u548c\u53d1\u5c55\u65b9\u5411\uff0c\u4ee5\u53ca\u7406\u89e3\u7528\u6237\u9700\u6c42\u7684\u91cd\u8981\u6027\u3002\u5728\u542c\u53d6\u793e\u533a\u53cd\u9988\u4e4b\u540e\uff0c\u6211\u4eec\u5b8c\u5168\u91cd\u505a\u4e86\u63d0\u6848\uff0c\u786e\u8ba4 Composition API \u53ea\u662f\u9526\u4e0a\u6dfb\u82b1\uff0c\u662f Options API \u7684\u8865\u5145\u3002\u65b0\u7248\u63d0\u6848\u7684\u53cd\u9988\u8981\u6b63\u9762\u8bb8\u591a\uff0c\u6211\u4eec\u8fd8\u6536\u5230\u4e86\u5f88\u591a\u5efa\u8bbe\u6027\u7684\u610f\u89c1\u3002<\/p>\n<section style=\"text-align: center; font-size: 20px;\"><span style=\"height: 65px; line-height: 95px; color: #3c70c6; border-bottom: 2px solid #1b5fa0; background-image: url('http:\/\/www.zhushiyao.com\/wp-content\/uploads\/2020\/05\/3-1590743317.jpeg'); background-position: 50% 50%; background-repeat: no-repeat; background-attachment: initial; background-origin: initial; background-clip: initial; background-size: 92px; margin-top: 38px; margin-bottom: 10px; padding-bottom: 7px; display: inline-block;\">\u628a\u63e1\u5e73\u8861<\/span><\/section>\n<blockquote style=\"margin-top: 0px; margin-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: none;\">\n<p style=\"font-size: 16px; white-space: pre-line; line-height: 1.75em; margin-top: 27px; padding-right: 20px; padding-left: 20px; color: #5baceb;\">\u5f00\u53d1\u4eba\u5458\u7684\u591a\u6837\u6027\u610f\u5473\u7740\u4f7f\u7528\u573a\u666f\u7684\u591a\u6837\u6027\u3002<\/p>\n<\/blockquote>\n<p style=\"white-space: pre-line; padding-top: 23px; padding-right: 8px; padding-left: 8px; color: #4a4a4a; line-height: 1.75em;\">\u5982\u4eca\u6709\u8d85\u8fc7\u4e00\u767e\u4e07\u7684\u5f00\u53d1\u4eba\u5458\u5728\u4f7f\u7528 Vue\uff0c\u5176\u4e2d\u6709\u53ea\u61c2\u4e00\u70b9 HTML\/CSS \u7684\u65b0\u624b\uff0c\u4ece jQuery \u4e00\u8def\u8d70\u6765\u7684\u4e13\u5bb6\uff0c\u4ece\u5176\u4ed6\u6846\u67b6\u8fc1\u79fb\u8fc7\u6765\u7684\u8001\u9e1f\uff0c\u5728\u5bfb\u627e\u524d\u7aef\u89e3\u51b3\u65b9\u6848\u7684\u540e\u7aef\u5de5\u7a0b\u5e08\uff0c\u8fd8\u6709\u8d1f\u8d23\u8bbe\u8ba1\u5927\u89c4\u6a21\u8f6f\u4ef6\u7684\u67b6\u6784\u5e08\u3002\u5f00\u53d1\u4eba\u5458\u7684\u591a\u6837\u6027\u610f\u5473\u7740\u4f7f\u7528\u573a\u666f\u7684\u591a\u6837\u6027\uff1a\u6709\u7684\u5f00\u53d1\u4eba\u5458\u53ef\u80fd\u60f3\u8981\u63d0\u5347\u65e7\u9879\u76ee\u7684\u4ea4\u4e92\u4f53\u9a8c\uff0c\u53e6\u4e00\u4e9b\u4eba\u53ef\u80fd\u60f3\u8981\u5feb\u901f\u5f00\u53d1\u4f4e\u6210\u672c\u7684\u4e00\u6b21\u6027\u9879\u76ee\uff1b\u67b6\u6784\u5e08\u53ef\u80fd\u8981\u5e94\u5bf9\u89c4\u6a21\u5de8\u5927\u7684\u957f\u671f\u9879\u76ee\uff0c\u4ee5\u53ca\u9879\u76ee\u751f\u547d\u5468\u671f\u5185\u7684\u5f00\u53d1\u56e2\u961f\u6210\u5458\u53d8\u52a8\u3002<\/p>\n<p style=\"white-space: pre-line; padding-top: 23px; padding-right: 8px; padding-left: 8px; color: #4a4a4a; line-height: 1.75em;\">Vue \u7684\u8bbe\u8ba1\u5728\u4e0d\u65ad\u6839\u636e\u8fd9\u4e9b\u9700\u6c42\u53d8\u5316\u548c\u53d1\u5c55\uff0c\u6211\u4eec\u4e5f\u8bbe\u6cd5\u4ece\u8bf8\u591a\u6743\u8861\u4e2d\u627e\u5230\u5e73\u8861\u70b9\u3002Vue \u7684\u53e3\u53f7\u201c\u6e10\u8fdb\u5f0f\u6846\u67b6\u201d\uff0c\u80cc\u540e\u5c31\u662f\u8fd9\u4e2a\u8fc7\u7a0b\u4e2d\u5f62\u6210\u7684\u5206\u5c42 API \u8bbe\u8ba1\u3002\u65b0\u624b\u53ef\u4ee5\u901a\u8fc7 CDN script\u3001\u57fa\u4e8e HTML \u7684\u6a21\u677f\u4ee5\u53ca\u76f4\u89c2\u7684 Options API \u987a\u5229\u5b66\u4e60\u5165\u95e8\u3002\u800c\u4e13\u5bb6\u53ef\u4ee5\u901a\u8fc7\u5168\u529f\u80fd\u7684 CLI\u3001\u6e32\u67d3\u51fd\u6570\u4ee5\u53ca Composition API \u6765\u5904\u7406\u590d\u6742\u9700\u6c42\u3002<\/p>\n<p style=\"white-space: pre-line; padding-top: 23px; padding-right: 8px; padding-left: 8px; color: #4a4a4a; line-height: 1.75em;\">\u8981\u5b9e\u73b0\u6211\u4eec\u7684\u613f\u666f\u8fd8\u6709\u5f88\u591a\u5de5\u4f5c\u8981\u505a\uff0c\u5176\u4e2d\u6700\u91cd\u8981\u7684\u5c31\u662f\u66f4\u65b0\u652f\u6301\u5e93\u3001\u6587\u6863\u548c\u5de5\u5177\uff0c\u4ee5\u4fdd\u8bc1\u5e73\u6ed1\u7684\u8fc1\u79fb\u3002\u6211\u4eec\u4f1a\u5728\u672a\u6765\u7684\u51e0\u4e2a\u6708\u4e2d\u7ee7\u7eed\u52aa\u529b\uff0c\u800c\u4e14\u6211\u4eec\u8feb\u4e0d\u53ca\u5f85\u60f3\u8981\u770b\u5230\u793e\u533a\u80fd\u7528 Vue 3 \u521b\u9020\u600e\u6837\u7684\u7cbe\u5f69\u4e86\u3002<\/p>\n<section style=\"text-align: left; margin-top: 30px; margin-left: 8px; color: #3c70c6;\">\u4f5c\u8005\u4ecb\u7ecd<\/section>\n<p style=\"white-space: pre-line; padding-top: 23px; padding-right: 8px; padding-left: 8px; color: #4a4a4a; line-height: 1.75em;\">\u5c24\u96e8\u6eaa\u662f Vue.js \u6846\u67b6\u7684\u521b\u5efa\u8005\u548c\u9879\u76ee\u9886\u5bfc\uff0c\u4e5f\u662f\u4e00\u4f4d\u72ec\u7acb\u5f00\u6e90\u5f00\u53d1\u8005\u3002<\/p>\n<section style=\"text-align: left; margin-top: 30px; margin-left: 8px; color: #3c70c6;\">\u539f\u6587\u94fe\u63a5<\/section>\n<p style=\"white-space: pre-line; padding-top: 23px; padding-right: 8px; padding-left: 8px; color: #4a4a4a; line-height: 1.75em;\"><span style=\"color: #888888; font-size: 14px;\">https:\/\/increment.com\/frontend\/making-vue-3\/<\/span><\/p>\n<section style=\"color: #3f3f3f; font-family: Avenir, -apple-system-font, \u5fae\u8f6f\u96c5\u9ed1, sans-serif; font-size: 16px; white-space: normal;\"><\/section>\n<p style=\"padding-top: 23px; padding-right: 8px; padding-left: 8px; font-family: Avenir, -apple-system-font, \u5fae\u8f6f\u96c5\u9ed1, sans-serif; font-size: 16px; white-space: pre-line; color: #4a4a4a; line-height: 1.75em; text-align: left;\">\n<\/section>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u4f5c\u8005 | \u5c24\u96e8\u6eaa \u8bd1\u8005 | \u738b\u5f3a \u7f16\u8f91 | \u8521\u82b3\u82b3 \u5c24\u96e8\u6eaa\u5728\u4eca\u5e74\u5e74\u521d Vue 3 \u6b63\u5f0f\u53d1\u5e03\u4e4b\u524d\u64b0\u5199\u4e86\u8fd9\u7bc7\u957f\u6587\uff0c &hellip; <a href=\"http:\/\/www.zhushiyao.com\/?p=27865\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb<span class=\"screen-reader-text\">\u201c\u5c24\u96e8\u6eaa\u81ea\u8ff0\uff1a\u6253\u9020Vue 3\u80cc\u540e\u7684\u6545\u4e8b\u201d<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[2],"tags":[365],"_links":{"self":[{"href":"http:\/\/www.zhushiyao.com\/index.php?rest_route=\/wp\/v2\/posts\/27865"}],"collection":[{"href":"http:\/\/www.zhushiyao.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.zhushiyao.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.zhushiyao.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.zhushiyao.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=27865"}],"version-history":[{"count":2,"href":"http:\/\/www.zhushiyao.com\/index.php?rest_route=\/wp\/v2\/posts\/27865\/revisions"}],"predecessor-version":[{"id":27873,"href":"http:\/\/www.zhushiyao.com\/index.php?rest_route=\/wp\/v2\/posts\/27865\/revisions\/27873"}],"wp:attachment":[{"href":"http:\/\/www.zhushiyao.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=27865"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.zhushiyao.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=27865"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.zhushiyao.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=27865"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}