{"id":3338,"date":"2022-05-01T20:30:20","date_gmt":"2022-05-01T12:30:20","guid":{"rendered":"http:\/\/www.yuguoxy.com\/geekhome\/?p=3338"},"modified":"2026-08-18T12:35:35","modified_gmt":"2026-08-18T04:35:35","slug":"%e7%ae%80%e6%98%93%e7%89%88vue%e6%a1%86%e6%9e%b6","status":"publish","type":"post","link":"https:\/\/ai.zhousir.top\/?p=3338","title":{"rendered":"\u7b80\u6613\u7248vue\u6846\u67b6"},"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;\"><strong style=\"color: #4870ac;\">Vue<\/strong> \u662f\u6784\u5efa\u7528\u6237\u754c\u9762\u7684\u6e10\u8fdb\u5f0f\u6846\u67b6\uff1a\u53ef\u4ee5\u4ece\u63d2\u503c\u7528\u8d77\uff0c\u518d\u9010\u6b65\u52a0\u6307\u4ee4\u3001\u7ec4\u4ef6\u3001\u8def\u7531\u3002 \u5b83\u9760\u6570\u636e\u9a71\u52a8\u548c\u7ec4\u4ef6\u5316\u5de5\u4f5c\u3002\u5982\u679c\u8fc7\u53bb\u4e60\u60ef\u7528 jQuery \u6539 DOM\uff0c\u5b66 Vue \u65f6\u5148\u653e\u4e0b\u300c\u624b\u52a8\u627e\u8282\u70b9\u300d\u7684\u601d\u8def\u2014\u2014\u7ed1\u5b9a\u4e00\u65e6\u5efa\u7acb\uff0c\u6539\u6570\u636e\uff0c\u89c6\u56fe\u4f1a\u8ddf\u7740\u66f4\u65b0\u3002<\/p>\n<p style=\"margin: 1em 0px;\">\u4e0b\u9762\u5e26\u4f60\u642d\u4e00\u4e2a\u7b80\u6613\u7248 Vue\uff1a\u5148\u5b8c\u6210\u6a21\u677f\u63d2\u503c <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;\">{{ }}<\/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;\">v-text<\/code> \u548c <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;\">v-model<\/code>\uff0c\u4f53\u4f1a\u53cc\u5411\u7ed1\u5b9a\u3002\u6e90\u7801\u5728 <a href=\"https:\/\/gitee.com\/yuguoxy\/vue-core.git\">https:\/\/gitee.com\/yuguoxy\/vue-core.git<\/a>\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\u8981\u5b9e\u73b0\u7684\u6548\u679c<\/h2>\n<p style=\"margin: 1em 0px;\">\u8f93\u5165\u6846\u6539\u6570\u636e\uff0c\u9875\u9762\u4e0a\u7684\u63d2\u503c\u548c <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;\">v-text<\/code> \u540c\u6b65\u53d8\uff1b\u6539\u6570\u636e\uff0c\u8f93\u5165\u6846\u4e5f\u540c\u6b65\u3002\u52a8\u56fe\u5982\u4e0b\uff1a<\/p>\n<p style=\"margin: 1em 0px;\"><a href=\"https:\/\/ai.zhousir.top\/wp-content\/uploads\/2022\/05\/vue1089.gif\" rel=\"fancybox\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone  wp-image-3340\" src=\"https:\/\/ai.zhousir.top\/wp-content\/uploads\/2022\/05\/vue1089.gif\" alt=\"vue1089\" width=\"601\" height=\"428\" srcset=\"https:\/\/ai.zhousir.top\/wp-content\/uploads\/2022\/05\/vue1089.gif 979w, https:\/\/ai.zhousir.top\/wp-content\/uploads\/2022\/05\/vue1089-140x100.gif 140w\" sizes=\"(max-width: 601px) 100vw, 601px\" \/><\/a><\/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\u9700\u8981\u638c\u63e1\u7684\u6280\u672f<\/h2>\n<ul style=\"padding-left: 1rem; margin-left: 1rem; font-size: 0.9rem; list-style-type: disc;\">\n<li>\n<section>\u9762\u5411\u5bf9\u8c61\uff1a\u7528 class \u62c6\u804c\u8d23\uff1b<\/section>\n<\/li>\n<li>\n<section>\u6570\u636e\u52ab\u6301\uff08getter \/ setter \u6216 Proxy\uff09\uff1b<\/section>\n<\/li>\n<li>\n<section>\u89c2\u5bdf\u8005\u6a21\u5f0f\uff1b<\/section>\n<\/li>\n<li>\n<section>\u6b63\u5219\u89e3\u6790\u6307\u4ee4\u548c\u63d2\u503c\uff1b<\/section>\n<\/li>\n<li>\n<section>\u9012\u5f52\u904d\u5386 DOM \u4e0e\u5d4c\u5957\u6570\u636e\u3002<\/section>\n<\/li>\n<\/ul>\n<p style=\"margin: 1em 0px;\"><strong style=\"color: #4870ac;\">MVVM<\/strong>\uff1aModel \u662f\u6570\u636e\uff0cView \u662f\u9875\u9762\uff0cViewModel \u628a\u4e24\u8005\u8fde\u8d77\u6765\u3002\u6570\u636e\u53d8 \u2192 \u89c6\u56fe\u66f4\u65b0\uff1b\u89c6\u56fe\u8f93\u5165 \u2192 \u5199\u56de\u6570\u636e\u3002<\/p>\n<p style=\"margin: 1em 0px;\"><a href=\"https:\/\/ai.zhousir.top\/wp-content\/uploads\/2022\/05\/1651377905890.png\" rel=\"fancybox\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone  wp-image-3341\" src=\"https:\/\/ai.zhousir.top\/wp-content\/uploads\/2022\/05\/1651377905890.png\" alt=\"1651377905890\" width=\"578\" height=\"292\" \/><\/a><\/p>\n<p style=\"margin: 1em 0px;\">\u6838\u5fc3\u7c7b\u6309\u8fd9\u5f20\u6d41\u7a0b\u62c6\uff1aVue\u3001Observer\u3001Dep\u3001Watcher\u3001Compiler\u3002<\/p>\n<p style=\"margin: 1em 0px;\"><a href=\"https:\/\/ai.zhousir.top\/wp-content\/uploads\/2022\/05\/1651377947542.png\" rel=\"fancybox\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone  wp-image-3342\" src=\"https:\/\/ai.zhousir.top\/wp-content\/uploads\/2022\/05\/1651377947542.png\" alt=\"1651377947542\" width=\"658\" height=\"271\" \/><\/a><\/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;\">\u7c7b<\/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;\">\u804c\u8d23<\/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;\">Vue<\/td>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">\u63a5\u6536 options\uff0c\u628a data \u6302\u5230\u5b9e\u4f8b\u4e0a\uff0c\u542f\u52a8 Observer \u548c Compiler<\/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;\">Observer<\/td>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">\u628a $data \u6210\u5458\u53d8\u6210 getter\/setter\uff0c\u521d\u59cb\u5316 Dep<\/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;\">Compiler<\/td>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">\u89e3\u6790\u6307\u4ee4\u548c\u63d2\u503c\u8868\u8fbe\u5f0f<\/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;\">Watcher<\/td>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">\u4e00\u4e2a\u8282\u70b9\u5bf9\u5e94\u4e00\u4e2a Watcher\uff0c\u7f16\u8bd1\u65f6\u767b\u8bb0\u5230 Dep<\/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;\">Dep<\/td>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">\u6536\u96c6 Watcher\uff0c\u6570\u636e\u53d8\u65f6\u901a\u77e5\u5b83\u4eec\u66f4\u65b0\u9875\u9762<\/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;\">\u4e09\u3001\u4e94\u7c7b\u600e\u4e48\u914d\u5408<\/h2>\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;\">1. Vue \u6838\u5fc3\u7c7b\n   1. \u63a5\u6536\u9009\u9879\u6570\u636e\n   2. data \u6ce8\u5165 Vue \u5b9e\u4f8b\uff08\u4f9b Compiler \u4f7f\u7528\uff09\n   3. \u8c03\u7528 Observer\uff0c\u5b9e\u73b0\u6570\u636e\u52ab\u6301\n   4. \u8c03\u7528 Compiler \u89e3\u6790\u6307\u4ee4\u4e0e\u6a21\u677f\u63d2\u503c\n2. Observer \u7c7b\n   1. \u6570\u636e\u52ab\u6301\uff0c\u628a $data \u4e2d\u7684\u6210\u5458\u8f6c\u6362\u6210 getter\/setter\n   2. \u521d\u59cb\u5316 Dep\n   3. \u5728 getter \u4e2d\u6dfb\u52a0\u4f9d\u8d56 Watcher\n   4. \u5728 setter \u4e2d\u901a\u77e5\u66f4\u65b0\u9875\u9762\n3. Compiler \u7c7b\n   1. \u8d1f\u8d23\u89e3\u6790\u6307\u4ee4 \/ \u63d2\u503c\u8868\u8fbe\u5f0f\n4. Watcher \u7c7b\n   \u66f4\u65b0\u9875\u9762\n   1. \u6bcf\u4e2a\u8282\u70b9\u5bf9\u5e94\u4e00\u4e2a Watcher\n   2. \u8282\u70b9\u7f16\u8bd1\u65f6\u5b9e\u4f8b\u5316\uff0c\u5b9e\u4f8b\u4fdd\u5b58\u5230 Dep\n5. Dep \u7c7b\n   \u6536\u96c6\u4f9d\u8d56 Watcher\n   \u901a\u77e5\u66f4\u65b0<\/code><\/pre>\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\u6e90\u7801\u548c\u4ee3\u7801\u56fe\u793a<\/h2>\n<p style=\"margin: 1em 0px;\">\u4ed3\u5e93\uff1a<a href=\"https:\/\/gitee.com\/yuguoxy\/vue-core.git\">https:\/\/gitee.com\/yuguoxy\/vue-core.git<\/a>\u3002\u5bf9\u7167\u4e0b\u9762\u8fd9\u5f20\u7ed3\u6784\u56fe\u8bfb\u7c7b\u4e4b\u95f4\u7684\u8c03\u7528\u5173\u7cfb\uff1a<\/p>\n<p style=\"margin: 1em 0px;\"><a href=\"https:\/\/ai.zhousir.top\/wp-content\/uploads\/2022\/05\/abcdef.jpeg\" rel=\"fancybox\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-3346\" src=\"https:\/\/ai.zhousir.top\/wp-content\/uploads\/2022\/05\/abcdef.jpeg\" alt=\"abcdef\" width=\"1499\" height=\"1020\" srcset=\"https:\/\/ai.zhousir.top\/wp-content\/uploads\/2022\/05\/abcdef.jpeg 1499w, https:\/\/ai.zhousir.top\/wp-content\/uploads\/2022\/05\/abcdef-90x60.jpeg 90w\" sizes=\"(max-width: 1499px) 100vw, 1499px\" \/><\/a><\/p>\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\u7b80\u6613 Vue \u5c31\u662f MVVM\uff1aObserver \u52ab\u6301\u6570\u636e\uff0cCompiler \u89e3\u6790\u6a21\u677f\uff0cDep \u6536\u96c6 Watcher\uff0c\u6570\u636e\u4e00\u53d8\u5c31\u901a\u77e5\u89c6\u56fe\u3002<\/strong><\/p>\n<\/blockquote>\n<\/section>\n","protected":false},"excerpt":{"rendered":"<p>Vue \u662f\u6784\u5efa\u7528\u6237\u754c\u9762\u7684\u6e10\u8fdb\u5f0f\u6846\u67b6\uff1a\u53ef\u4ee5\u4ece\u63d2\u503c\u7528\u8d77\uff0c\u518d\u9010\u6b65\u52a0\u6307\u4ee4\u3001\u7ec4\u4ef6\u3001\u8def\u7531\u3002 \u5b83\u9760\u6570\u636e\u9a71\u52a8\u548c\u7ec4\u4ef6\u5316\u5de5\u4f5c\u3002\u5982\u679c [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[106,105],"tags":[205],"_links":{"self":[{"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=\/wp\/v2\/posts\/3338"}],"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=3338"}],"version-history":[{"count":3,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=\/wp\/v2\/posts\/3338\/revisions"}],"predecessor-version":[{"id":3349,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=\/wp\/v2\/posts\/3338\/revisions\/3349"}],"wp:attachment":[{"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3338"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3338"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3338"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}