{"id":8307,"date":"2023-11-28T20:24:12","date_gmt":"2023-11-28T12:24:12","guid":{"rendered":"https:\/\/wx.kaifamiao.info\/?p=8307"},"modified":"2023-12-02T22:28:34","modified_gmt":"2023-12-02T14:28:34","slug":"vue-zhongvue-cli-zhong-zen-yang-shi-yong-zi-ding-y","status":"publish","type":"post","link":"http:\/\/wx.kaifamiao.info\/index.php\/2023\/11\/28\/vue-zhongvue-cli-zhong-zen-yang-shi-yong-zi-ding-y\/","title":{"rendered":"Vue \u4e2d vue.cli \u4e2d\u600e\u6837\u4f7f\u7528\u81ea\u5b9a\u4e49\u7684\u7ec4\u4ef6\uff1f\u6709\u9047\u5230\u8fc7\u54ea\u4e9b\u95ee\u9898\u5417\uff1f"},"content":{"rendered":"<p>\u5728 Vue CLI \u9879\u76ee\u4e2d\u4f7f\u7528\u81ea\u5b9a\u4e49\u7ec4\u4ef6\u901a\u5e38\u9075\u5faa\u4ee5\u4e0b\u6b65\u9aa4\uff1a<\/p>\n<h3><a id=\"%E5%88%9B%E5%BB%BA%E8%87%AA%E5%AE%9A%E4%B9%89%E7%BB%84%E4%BB%B6%EF%BC%9A\" class=\"anchor\" aria-hidden=\"true\"><span class=\"octicon octicon-link\"><\/span><\/a>\u521b\u5efa\u81ea\u5b9a\u4e49\u7ec4\u4ef6\uff1a<\/h3>\n<ol>\n<li>\n<p><strong>\u521b\u5efa\u7ec4\u4ef6\u6587\u4ef6\uff1a<\/strong> \u5728\u9879\u76ee\u7684\u5408\u9002\u4f4d\u7f6e\u521b\u5efa\u81ea\u5b9a\u4e49\u7ec4\u4ef6\u7684 <code>.vue<\/code> \u6587\u4ef6\uff0c\u6587\u4ef6\u5305\u542b\u6a21\u677f\u3001\u811a\u672c\u548c\u6837\u5f0f\u3002<\/p>\n<\/li>\n<li>\n<p><strong>\u7f16\u5199\u7ec4\u4ef6\u4ee3\u7801\uff1a<\/strong> \u5728 <code>.vue<\/code> \u6587\u4ef6\u4e2d\u7f16\u5199\u7ec4\u4ef6\u7684\u6a21\u677f\u3001\u903b\u8f91\u548c\u6837\u5f0f\u3002<\/p>\n<\/li>\n<\/ol>\n<h3><a id=\"%E5%9C%A8%E5%85%B6%E4%BB%96%E7%BB%84%E4%BB%B6%E4%B8%AD%E4%BD%BF%E7%94%A8%E8%87%AA%E5%AE%9A%E4%B9%89%E7%BB%84%E4%BB%B6%EF%BC%9A\" class=\"anchor\" aria-hidden=\"true\"><span class=\"octicon octicon-link\"><\/span><\/a>\u5728\u5176\u4ed6\u7ec4\u4ef6\u4e2d\u4f7f\u7528\u81ea\u5b9a\u4e49\u7ec4\u4ef6\uff1a<\/h3>\n<ol>\n<li><strong>\u5bfc\u5165\u7ec4\u4ef6\uff1a<\/strong> \u5728\u9700\u8981\u4f7f\u7528\u81ea\u5b9a\u4e49\u7ec4\u4ef6\u7684\u5730\u65b9\u5bfc\u5165\u7ec4\u4ef6\u3002<\/li>\n<\/ol>\n<pre><code class=\"language-javascript\">import CustomComponent from '@\/components\/CustomComponent.vue';\n<\/code><\/pre>\n<ol start=\"2\">\n<li><strong>\u6ce8\u518c\u7ec4\u4ef6\uff1a<\/strong> \u5728 Vue \u7ec4\u4ef6\u7684 <code>components<\/code> \u9009\u9879\u4e2d\u6ce8\u518c\u5bfc\u5165\u7684\u81ea\u5b9a\u4e49\u7ec4\u4ef6\u3002<\/li>\n<\/ol>\n<pre><code class=\"language-javascript\">export default {\n  components: {\n    CustomComponent,\n  },\n  \/\/ ...\n};\n<\/code><\/pre>\n<ol start=\"3\">\n<li><strong>\u5728\u6a21\u677f\u4e2d\u4f7f\u7528\uff1a<\/strong> \u5728\u6a21\u677f\u4e2d\u901a\u8fc7\u7ec4\u4ef6\u6807\u7b7e\u7684\u5f62\u5f0f\u4f7f\u7528\u81ea\u5b9a\u4e49\u7ec4\u4ef6\u3002<\/li>\n<\/ol>\n<pre><code class=\"language-html\">&lt;template&gt;\n  &lt;div&gt;\n    &lt;custom-component&gt;&lt;\/custom-component&gt;\n  &lt;\/div&gt;\n&lt;\/template&gt;\n<\/code><\/pre>\n<h3><a id=\"%E5%8F%AF%E8%83%BD%E9%81%87%E5%88%B0%E7%9A%84%E9%97%AE%E9%A2%98%EF%BC%9A\" class=\"anchor\" aria-hidden=\"true\"><span class=\"octicon octicon-link\"><\/span><\/a>\u53ef\u80fd\u9047\u5230\u7684\u95ee\u9898\uff1a<\/h3>\n<ol>\n<li>\n<p><strong>\u8def\u5f84\u95ee\u9898\uff1a<\/strong> \u5bfc\u5165\u7ec4\u4ef6\u65f6\u9700\u8981\u786e\u4fdd\u8def\u5f84\u6b63\u786e\uff0c\u7279\u522b\u662f\u5728\u4f7f\u7528 <code>@<\/code> \u6216 <code>~<\/code> \u522b\u540d\u65f6\u3002<\/p>\n<\/li>\n<li>\n<p><strong>\u5927\u5c0f\u5199\u95ee\u9898\uff1a<\/strong> \u5728\u6a21\u677f\u4e2d\u4f7f\u7528\u7ec4\u4ef6\u65f6\u8981\u786e\u4fdd\u7ec4\u4ef6\u540d\u79f0\u5927\u5c0f\u5199\u5339\u914d\u3002<\/p>\n<\/li>\n<li>\n<p><strong>\u5fd8\u8bb0\u6ce8\u518c\uff1a<\/strong> \u5982\u679c\u5fd8\u8bb0\u5728 <code>components<\/code> \u9009\u9879\u4e2d\u6ce8\u518c\u7ec4\u4ef6\uff0c\u4f1a\u5bfc\u81f4\u7ec4\u4ef6\u65e0\u6cd5\u4f7f\u7528\u3002<\/p>\n<\/li>\n<li>\n<p><strong>\u547d\u540d\u51b2\u7a81\uff1a<\/strong> \u7ec4\u4ef6\u547d\u540d\u548c\u73b0\u6709 HTML \u6807\u7b7e\u547d\u540d\u51b2\u7a81\u53ef\u80fd\u5bfc\u81f4\u7ec4\u4ef6\u4e0d\u8d77\u4f5c\u7528\u3002<\/p>\n<\/li>\n<li>\n<p><strong>\u5f15\u7528\u95ee\u9898\uff1a<\/strong> \u67d0\u4e9b\u60c5\u51b5\u4e0b\uff0c\u4f7f\u7528 webpack \u7684\u52a8\u6001\u5f15\u5165\u7ec4\u4ef6\u8bed\u6cd5\u53ef\u80fd\u9700\u8981\u7279\u6b8a\u5904\u7406\u3002<\/p>\n<\/li>\n<\/ol>\n<p>\u89e3\u51b3\u8fd9\u4e9b\u95ee\u9898\u901a\u5e38\u9700\u8981\u5bf9 Vue \u7684\u7ec4\u4ef6\u7cfb\u7edf\u3001\u6a21\u5757\u5bfc\u5165\u4ee5\u53ca\u57fa\u672c\u7684 Vue \u9879\u76ee\u7ed3\u6784\u6709\u4e00\u5b9a\u7684\u4e86\u89e3\u548c\u719f\u6089\u3002\u5904\u7406\u95ee\u9898\u65f6\uff0c\u4ed4\u7ec6\u68c0\u67e5\u6587\u4ef6\u8def\u5f84\u3001\u7ec4\u4ef6\u540d\u79f0\u3001\u5bfc\u5165\u548c\u6ce8\u518c\u8fc7\u7a0b\u4e2d\u7684\u62fc\u5199\u548c\u5927\u5c0f\u5199\u7b49\u60c5\u51b5\u662f\u5f88\u91cd\u8981\u7684\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5728 Vue CLI \u9879\u76ee\u4e2d\u4f7f\u7528\u81ea\u5b9a\u4e49\u7ec4\u4ef6\u901a\u5e38\u9075\u5faa\u4ee5\u4e0b\u6b65\u9aa4\uff1a \u521b\u5efa\u81ea\u5b9a\u4e49\u7ec4\u4ef6\uff1a \u521b\u5efa\u7ec4\u4ef6\u6587\u4ef6\uff1a \u5728\u9879\u76ee\u7684\u5408\u9002\u4f4d\u7f6e [&hellip;]<\/p>\n","protected":false},"author":11,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[114],"tags":[],"class_list":["post-8307","post","type-post","status-publish","format-standard","hentry","category-vue"],"_links":{"self":[{"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/posts\/8307","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/users\/11"}],"replies":[{"embeddable":true,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/comments?post=8307"}],"version-history":[{"count":2,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/posts\/8307\/revisions"}],"predecessor-version":[{"id":14090,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/posts\/8307\/revisions\/14090"}],"wp:attachment":[{"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/media?parent=8307"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/categories?post=8307"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/tags?post=8307"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}