{"id":955,"date":"2020-03-26T20:18:42","date_gmt":"2020-03-26T12:18:42","guid":{"rendered":"https:\/\/www.bluesdream.com\/blog\/?p=955"},"modified":"2020-03-26T21:28:44","modified_gmt":"2020-03-26T13:28:44","slug":"create-electron-vue-project","status":"publish","type":"post","link":"https:\/\/www.bluesdream.com\/blog\/create-electron-vue-project.html","title":{"rendered":"electron-vue \u521b\u5efa Electron + Vue \u9879\u76ee"},"content":{"rendered":"<p>Electron \u662f\u7531 GitHub \u5f00\u53d1\u7684\u4e00\u4e2a\u5f00\u6e90\u6846\u67b6\u3002\u5b83\u5141\u8bb8\u4f7f\u7528 <code>Node.js\uff08\u4f5c\u4e3a\u540e\u7aef\uff09<\/code>\u548c <code>Chromium\uff08\u4f5c\u4e3a\u524d\u7aef\uff09<\/code>\u5b8c\u6210 <code>\u684c\u9762GUI\u5e94\u7528<\/code> \u7a0b\u5e8f\u7684\u5f00\u53d1\u3002<\/p>\n<p>\u6211\u4eec\u6240\u5e38\u7528\u7684 Visual Studio Code \u548c Atom \u90fd\u662f\u57fa\u4e8e Electron \u6846\u67b6\u3002<\/p>\n<p>\u53bb\u5e74\u7531\u4e8e\u4e1a\u52a1\u9700\u6c42\uff0c\u6709\u8003\u8651\u5c06\u4ea7\u54c1\u8fc1\u79fb\u81f3 Electron \u6765\u89e3\u51b3 Web \u7aef\u7684\u90e8\u5206\u77ed\u677f\u3002<\/p>\n<p><strong>\u5f53\u65f6\u4e3b\u8981\u8003\u8651\u7684\u51e0\u70b9\u56e0\u7d20\uff1a<\/strong><\/p>\n<ul>\n<li>\u90e8\u5206\u7532\u65b9\u4e0d\u5e0c\u671b\u4ea7\u54c1\u901a\u8fc7\u7f51\u9875\u5f62\u5f0f\u5c55\u73b0\uff08\u8981\u4ee5\u5ba2\u6237\u7aef\u5f62\u5f0f\uff09\uff0c\u518d\u5355\u72ec\u5f00\u53d1\u4e00\u5957\u684c\u9762\u5e94\u7528\u6210\u672c\u8f83\u5927<\/li>\n<li>\u6d4f\u89c8\u5668\u4e0d\u652f\u6301 H265 \u539f\u751f\u89c6\u9891\u64ad\u653e<\/li>\n<li>\u53ef\u4ee5\u4f7f\u7528\u64cd\u4f5c\u7cfb\u7edf API<\/li>\n<li>\u4ea7\u54c1\u7279\u6027\u56e0\u7d20\uff0c\u957f\u671f\u6302\u7740 Web \u7aef\u6027\u80fd\u4e0d\u4f73<\/li>\n<\/ul>\n<p><!--more--><\/p>\n<p><strong>\u4f46\u4f7f\u7528 <code>simulatedgreg\/electron-vue<\/code> \u4e5f\u662f\u6709\u6761\u4ef6\u7684\uff1a<\/strong><\/p>\n<ul>\n<li>\u9700\u8981\u4f7f\u7528 <code>node@^7<\/code> \u6216\u66f4\u9ad8\u7248\uff08\u9664\u8001\u9879\u76ee\u5916\uff0c\u5bf9\u5927\u591a\u6570\u4eba\u6765\u8bf4\u4e0d\u662f\u95ee\u9898\uff09<\/li>\n<li>\u9002\u7528\u4e8e <code>vue-cli@2.x<\/code> \u521b\u5efa\u9879\u76ee\uff08\u4e0d\u517c\u5bb9 vue-cli@3.x \u6216\u4ee5\u4e0a\u7248\u672c\uff09<\/li>\n<\/ul>\n<p>\u4f60\u7684\u9879\u76ee\u57fa\u4e8e <code>vue-cli@2.x<\/code> \u521b\u5efa\uff0c\u5e76\u4e14\u7531\u4e8e\u5404\u79cd\u56e0\u7d20\u6ca1\u6709\u5347\u7ea7\u8ba1\u5212\uff0c\u90a3\u53ef\u4ee5\u8003\u8651\u4e00\u4e0b\u3002<\/p>\n<blockquote><p>\n  \u5982\u679c\u9879\u76ee\u57fa\u4e8e <code>vue-cli@3.x<\/code> \u521b\u5efa\uff0c\u5efa\u8bae\u91c7\u53d6 <code>electron-builder<\/code> \u65b9\u6848\u6784\u5efa\u5f00\u53d1\u73af\u5883\u3002\n<\/p><\/blockquote>\n<h2>\u9879\u76ee\u642d\u5efa\uff1a<\/h2>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n# \u5b89\u88c5 vue-cli@2.x\nyarn global add vue-cli\n\n# \u5b89\u88c5\uff1a\u811a\u624b\u67b6\u6837\u677f\u4ee3\u7801\nvue init simulatedgreg\/electron-vue electron-project\n\n# \u8bbe\u7f6e\u5e94\u7528\u540d\u79f0 - my-project\nApplication Name (my-project)\n\n# APP \u7684 ID \u5efa\u8bae\u4e3a com.\u516c\u53f8\u540d.\u5e94\u7528\u540d - com.example.yourapp\nApplication Id (com.example.yourapp)\n\n# APP \u7248\u672c - 0.0.1    \nApplication Version (0.0.1)\n\n# \u9879\u76ee\u63cf\u8ff0 - An electron-vue project\nProject description (An electron-vue project)\n\n# \u662f\u5426\u4f7f\u7528 Sass \u6216 Scss - Yes\nUse Sass \/ Scss? (Y\/n)\n\n# \u9009\u62e9\u9700\u8981\u4f7f\u7528\u7684 Vue \u63d2\u4ef6\/\u4f9d\u8d56 - axios, vue-electron, vue-router, vuex, vuex-electron\n? Select which Vue plugins to install (Press &lt;space&gt; to select, &lt;a&gt; to toggle al\nl, &lt;i&gt; to invert selection)\n\u276f\u25c9 axios\n \u25c9 vue-electron\n \u25c9 vue-router\n \u25c9 vuex\n \u25c9 vuex-electron\n\n# \u4f7f\u7528 ESLint \u8bed\u6cd5\u68c0\u6d4b - Yes\n? Use linting with ESLint? (Y\/n) \n\n# \u9009\u62e9 ESLint \u8bed\u6cd5\u68c0\u6d4b\u89c4\u5219 - Standard\n? Which ESLint config would you like to use? (Use arrow keys)\n\u276f Standard (https:\/\/github.com\/feross\/standard) \n  Airbnb (https:\/\/github.com\/airbnb\/javascript) \n  none (configure it yourself)\n\n# \u662f\u5426\u4f7f\u7528 Karma + Mocha \u5355\u5143\u6d4b\u8bd5 - No\n? Set up unit testing with Karma + Mocha? (Y\/n)\n\n# \u662f\u5426\u4f7f\u7528 Spectron + Mocha \u7aef\u5230\u7aef\u6d4b\u8bd5 - No\n? Set up end-to-end testing with Spectron + Mocha? (Y\/n)\n\n# \u9009\u62e9\u6253\u5305\u5de5\u5177\uff08builder \u66f4\u8f7b\u91cf\uff09 - electron-builder\n? What build tool would you like to use? (Use arrow keys)\n\u276f electron-builder (https:\/\/github.com\/electron-userland\/electron-builder) \n  electron-packager (https:\/\/github.com\/electron-userland\/electron-packager)\n\n# \u9879\u76ee\u4f5c\u8005 - \u81ea\u5b9a\u4e49\n? author (Ryan Zhong &lt;hi@bluesdream.com&gt;)\n\n# \u8fdb\u5165\u9879\u76ee\ncd electron-project\n\n# \u901a\u8fc7 yarn \u5b89\u88c5\u4f9d\u8d56\nyarn\n\n# \u8fd0\u884c\u9879\u76ee\nyarn run dev\n\n# \u9879\u76ee\u7f16\u8bd1\nyarn run build\n<\/pre>\n<blockquote><p>\n  \u6ce8\uff1a\u6a21\u677f\u6240\u9ed8\u8ba4\u5b89\u88c5\u7684 Electron \u7248\u672c\u4e3a <code>2.0.4<\/code> \u82e5\u8981\u4f7f\u7528\u66f4\u9ad8\u7248\u672c\u9700\u81ea\u884c\u5347\u7ea7\u3002\n<\/p><\/blockquote>\n<h2>\u53c2\u8003\u8d44\u6599\uff1a<\/h2>\n<p><a href=\"https:\/\/simulatedgreg.gitbooks.io\/electron-vue\/content\/cn\/\">electron-vue \u4e2d\u6587\u6587\u6863<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Electron \u662f\u7531 GitHub \u5f00\u53d1\u7684\u4e00\u4e2a\u5f00\u6e90\u6846\u67b6\u3002\u5b83\u5141\u8bb8\u4f7f\u7528 Node.js\uff08\u4f5c\u4e3a\u540e\u7aef\uff09\u548c Chromium\uff08\u4f5c\u4e3a\u524d\u7aef\uff09\u5b8c\u6210 \u684c\u9762GUI\u5e94\u7528 \u7a0b\u5e8f\u7684\u5f00\u53d1\u3002 \u6211\u4eec\u6240\u5e38\u7528\u7684 Visual Studio Code \u548c Atom \u90fd\u662f\u57fa\u4e8e Electron \u6846\u67b6\u3002 \u53bb\u5e74\u7531\u4e8e\u4e1a\u52a1\u9700\u6c42\uff0c\u6709\u8003\u8651\u5c06\u4ea7\u54c1\u8fc1\u79fb\u81f3 Electron \u6765\u89e3\u51b3 Web \u7aef\u7684\u90e8\u5206\u77ed\u677f\u3002 \u5f53\u65f6\u4e3b\u8981\u8003\u8651\u7684\u51e0\u70b9\u56e0\u7d20\uff1a \u90e8\u5206\u7532\u65b9\u4e0d\u5e0c\u671b\u4ea7\u54c1\u901a\u8fc7\u7f51\u9875\u5f62\u5f0f\u5c55\u73b0\uff08\u8981\u4ee5\u5ba2\u6237\u7aef\u5f62\u5f0f\uff09\uff0c\u518d\u5355\u72ec\u5f00\u53d1\u4e00\u5957\u684c\u9762\u5e94\u7528\u6210\u672c\u8f83\u5927 \u6d4f\u89c8\u5668\u4e0d\u652f\u6301 H265 \u539f\u751f\u89c6\u9891\u64ad\u653e \u53ef\u4ee5\u4f7f\u7528\u64cd\u4f5c\u7cfb\u7edf API \u4ea7\u54c1\u7279\u6027\u56e0\u7d20\uff0c\u957f\u671f\u6302\u7740 Web \u7aef\u6027\u80fd\u4e0d\u4f73<\/p>\n","protected":false},"author":1,"featured_media":957,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[75],"tags":[194,177,178],"class_list":["post-955","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-front-end","tag-electron","tag-vue","tag-vue-cli"],"_links":{"self":[{"href":"https:\/\/www.bluesdream.com\/blog\/wp-json\/wp\/v2\/posts\/955"}],"collection":[{"href":"https:\/\/www.bluesdream.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.bluesdream.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.bluesdream.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.bluesdream.com\/blog\/wp-json\/wp\/v2\/comments?post=955"}],"version-history":[{"count":0,"href":"https:\/\/www.bluesdream.com\/blog\/wp-json\/wp\/v2\/posts\/955\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.bluesdream.com\/blog\/wp-json\/wp\/v2\/media\/957"}],"wp:attachment":[{"href":"https:\/\/www.bluesdream.com\/blog\/wp-json\/wp\/v2\/media?parent=955"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.bluesdream.com\/blog\/wp-json\/wp\/v2\/categories?post=955"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.bluesdream.com\/blog\/wp-json\/wp\/v2\/tags?post=955"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}