{"id":21620,"date":"2024-11-19T15:30:16","date_gmt":"2024-11-19T07:30:16","guid":{"rendered":"https:\/\/fwq.ai\/blog\/21620\/"},"modified":"2024-11-19T15:30:16","modified_gmt":"2024-11-19T07:30:16","slug":"vscode%e5%a6%82%e4%bd%95%e9%85%8d%e7%bd%aevue","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/21620\/","title":{"rendered":"vscode\u5982\u4f55\u914d\u7f6evue"},"content":{"rendered":"<blockquote><p>\n  \u5982\u4f55\u914d\u7f6e vscode \u4ee5\u7f16\u5199 vue\uff1a\u5b89\u88c5 vue cli \u548c vscode vue \u63d2\u4ef6\u3002\u521b\u5efa\u4e00\u4e2a vue \u9879\u76ee\u3002\u8bbe\u7f6e\u8bed\u6cd5\u9ad8\u4eae\u663e\u793a\u3001linting\u3001\u81ea\u52a8\u683c\u5f0f\u5316\u548c\u4ee3\u7801\u6bb5\u3002\u5b89\u88c5 eslint \u548c prettier \u4ee5\u589e\u5f3a\u4ee3\u7801\u8d28\u91cf\u3002\u96c6\u6210 git\uff08\u53ef\u9009\uff09\u3002\u914d\u7f6e\u5b8c\u6210\u540e\uff0cvscode \u5df2\u51c6\u5907\u597d\u8fdb\u884c vue \u5f00\u53d1\u3002\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202406\/07\/2024060707392393491.jpg\" class=\"aligncenter\" title=\"vscode\u5982\u4f55\u914d\u7f6evue\u63d2\u56fe\" alt=\"vscode\u5982\u4f55\u914d\u7f6evue\u63d2\u56fe\" \/><\/p>\n<p><strong>\u5982\u4f55\u914d\u7f6e VSCode \u4ee5\u7f16\u5199 Vue<\/strong><\/p>\n<p><strong>\u5feb\u901f\u5165\u95e8<\/strong><\/p>\n<p>\u8981\u914d\u7f6e VSCode \u7f16\u5199 Vue\uff0c\u8bf7\u6267\u884c\u4ee5\u4e0b\u6b65\u9aa4\uff1a<\/p>\n<ol>\n<li>\u5b89\u88c5 Vue CLI<\/li>\n<li>\u5b89\u88c5 VSCode Vue \u63d2\u4ef6<\/li>\n<li>\u521b\u5efa Vue \u9879\u76ee<\/li>\n<\/ol>\n<p><strong>\u5b89\u88c5 Vue CLI<\/strong><\/p>\n<p><span>\u7acb\u5373\u5b66\u4e60<\/span>\u201c\u201d\uff1b<\/p>\n<p>\u4f7f\u7528 npm \u6216 yarn \u5b89\u88c5 Vue CLI\uff1a<\/p>\n<pre>npm install -g @vue\/cli<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u6216<\/p>\n<pre>yarn global add @vue\/cli<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u5b89\u88c5 VSCode Vue \u63d2\u4ef6<\/strong><\/p>\n<p>\u6253\u5f00 VSCode\uff0c\u8f6c\u5230\u6269\u5c55\u5546\u5e97\u5e76\u641c\u7d22 &#8220;Vue.js Extension Pack&#8221;\u3002\u5b89\u88c5\u8be5\u63d2\u4ef6\u3002<\/p>\n<p><strong>\u521b\u5efa Vue \u9879\u76ee<\/strong><\/p>\n<p>\u521b\u5efa\u4e00\u4e2a\u65b0\u7684 Vue \u9879\u76ee\uff1a<\/p>\n<pre>vue create my-project<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u8fd9\u5c06\u5728 my-project \u6587\u4ef6\u5939\u4e2d\u521b\u5efa\u4e00\u4e2a\u65b0\u7684 Vue \u9879\u76ee\u3002<\/p>\n<p><strong>\u8be6\u7ec6\u914d\u7f6e<\/strong><\/p>\n<p><strong>1. \u8bbe\u7f6e\u8bed\u6cd5\u9ad8\u4eae\u663e\u793a\u548c linting<\/strong><\/p>\n<ul>\n<li>\u8f6c\u5230 &#8220;\u6587\u4ef6&#8221; &gt; &#8220;\u9996\u9009\u9879&#8221; &gt; &#8220;\u8bbe\u7f6e&#8221;\u3002<\/li>\n<li>\u641c\u7d22 &#8220;Vue.js&#8221; \u5e76\u542f\u7528 &#8220;Vetur: Enable Vue.js and Template Linting&#8221;\u3002<\/li>\n<\/ul>\n<p><strong>2. \u542f\u7528\u81ea\u52a8\u683c\u5f0f\u5316<\/strong><\/p>\n<ul>\n<li>\u641c\u7d22 &#8220;Editor: Default Formatter&#8221;\u3002<\/li>\n<li>\u9009\u62e9 &#8220;Vetur: Vue.js and Template Formatter&#8221;\u3002<\/li>\n<\/ul>\n<p><strong>3. \u8bbe\u7f6e\u4ee3\u7801\u6bb5<\/strong><\/p>\n<ul>\n<li>\u8f6c\u5230 &#8220;\u6587\u4ef6&#8221; &gt; &#8220;\u9996\u9009\u9879&#8221; &gt; &#8220;\u4ee3\u7801\u6bb5&#8221;\u3002<\/li>\n<li>\u641c\u7d22 &#8220;Vue&#8221; \u5e76\u542f\u7528\u6240\u9700\u7684\u4ee3\u7801\u6bb5\u3002<\/li>\n<\/ul>\n<p><strong>4. \u5b89\u88c5 ESLint \u548c Prettier<\/strong><\/p>\n<ul>\n<li>\u5b89\u88c5 ESLint \u548c Prettier\uff1a<\/li>\n<\/ul>\n<pre>npm install eslint prettier --save-dev<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<ul>\n<li>\u521b\u5efa\u4e00\u4e2a .eslintrc.js \u6587\u4ef6\u5e76\u6dfb\u52a0\u4ee5\u4e0b\u5185\u5bb9\uff1a<\/li>\n<\/ul>\n<pre>module.exports = {\n  extends: ['plugin:vue\/essential'],\n  rules: {\n    'vue\/no-v-html': 'off',\n  },\n};<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<ul>\n<li>\u521b\u5efa\u4e00\u4e2a .prettierrc.js \u6587\u4ef6\u5e76\u6dfb\u52a0\u4ee5\u4e0b\u5185\u5bb9\uff1a<\/li>\n<\/ul>\n<pre>module.exports = {\n  semi: true,\n  trailingComma: 'all',\n  singleQuote: true,\n  printWidth: 100,\n};<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>5. \u96c6\u6210 Git<\/strong><\/p>\n<ul>\n<li>\u5982\u679c\u4f60\u4f7f\u7528 Git\uff0c\u5219\u53ef\u4ee5\u5b89\u88c5 &#8220;GitLens&#8221; \u63d2\u4ef6\u4ee5\u66f4\u597d\u5730\u96c6\u6210 Git \u529f\u80fd\u3002<\/li>\n<\/ul>\n<p><strong>\u4eab\u53d7 Vue \u5f00\u53d1\uff01<\/strong><\/p>\n<p>\u901a\u8fc7\u4e0a\u8ff0\u914d\u7f6e\uff0cVSCode \u73b0\u5728\u5df2\u4e3a Vue \u5f00\u53d1\u505a\u597d\u51c6\u5907\u3002\u4eab\u53d7\u4f7f\u7528 VSCode \u8fdb\u884c\u9ad8\u6548\u800c\u6109\u5feb\u7684 Vue \u7f16\u7801\u5427\uff01<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u5982\u4f55\u914d\u7f6e\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5982\u4f55\u914d\u7f6e vscode \u4ee5\u7f16\u5199 vue\uff1a\u5b89\u88c5 vue cli \u548c vscode vue \u63d2\u4ef6\u3002\u521b\u5efa\u4e00\u4e2a vue \u9879\u76ee\u3002\u8bbe\u7f6e\u8bed\u6cd5\u9ad8\u4eae\u663e\u793a\u3001linting\u3001\u81ea\u52a8\u683c\u5f0f\u5316\u548c\u4ee3\u7801\u6bb5\u3002\u5b89\u88c5 eslint \u548c prettier \u4ee5\u589e\u5f3a\u4ee3\u7801\u8d28\u91cf\u3002\u96c6\u6210 git\uff08\u53ef\u9009\uff09\u3002\u914d\u7f6e\u5b8c\u6210\u540e\uff0cvscode \u5df2\u51c6\u5907\u597d\u8fdb\u884c vue \u5f00\u53d1\u3002 \u5982\u4f55\u914d\u7f6e VSCode \u4ee5\u7f16\u5199 Vue \u5feb\u901f\u5165\u95e8 \u8981\u914d\u7f6e VSCode \u7f16\u5199 Vue\uff0c\u8bf7\u6267\u884c\u4ee5\u4e0b\u6b65\u9aa4\uff1a \u5b89\u88c5 Vue CLI \u5b89\u88c5 VSCode Vue \u63d2\u4ef6 \u521b\u5efa Vue \u9879\u76ee \u5b89\u88c5 Vue CLI \u7acb\u5373\u5b66\u4e60\u201c\u201d\uff1b \u4f7f\u7528 npm \u6216 yarn \u5b89\u88c5 Vue CLI\uff1a npm install -g @vue\/cli \u767b\u5f55\u540e\u590d\u5236 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-21620","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/21620","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=21620"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/21620\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=21620"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=21620"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=21620"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}