{"id":23775,"date":"2024-02-26T15:43:17","date_gmt":"2024-02-26T07:43:17","guid":{"rendered":"https:\/\/app.60day.cn\/appday\/?p=23775"},"modified":"2024-02-26T15:43:17","modified_gmt":"2024-02-26T07:43:17","slug":"vue%e9%a1%b9%e7%9b%ae%e6%89%93%e5%8c%85exe%e9%a1%b9%e7%9b%ae%e6%93%8d%e4%bd%9c%e5%8a%9e%e6%b3%95","status":"publish","type":"post","link":"https:\/\/app.60day.cn\/appday\/kaifaexe\/23775\/","title":{"rendered":"vue\u9879\u76ee\u6253\u5305exe\u9879\u76ee\u64cd\u4f5c\u529e\u6cd5"},"content":{"rendered":"<p>Vue\u662f\u4e00\u79cd\u6d41\u884c\u7684JavaScript\u6846\u67b6\uff0c\u7528\u4e8e\u6784\u5efa\u5355\u9875\u5e94\u7528\u7a0b\u5e8f\u3002\u5f53\u4f60\u5b8c\u6210\u4e86\u4e00\u4e2aVue\u9879\u76ee\u540e\uff0c\u4f60\u53ef\u80fd\u60f3\u5c06\u5b83\u6253\u5305\u6210\u4e00\u4e2a\u53ef\u6267\u884c\u6587\u4ef6\uff08exe\uff09\u4ee5\u4fbf\u5728\u5176\u4ed6\u8ba1\u7b97\u673a\u4e0a\u8fd0\u884c\u3002\u5728\u672c\u6587\u4e2d\uff0c\u6211\u4eec\u5c06\u6df1\u5165\u63a2\u8ba8\u5982\u4f55\u5c06Vue\u9879\u76ee\u6253\u5305\u4e3a\u53ef\u6267\u884c\u6587\u4ef6\u3002<\/p>\n<p>\u9996\u5148\uff0c\u6211\u4eec\u9700\u8981\u4e86\u89e3Vue\u9879\u76ee\u7684\u6253\u5305\u539f\u7406\u3002Vue\u9879\u76ee\u7684\u6253\u5305\u8fc7\u7a0b\u5b9e\u9645\u4e0a\u662f\u5c06\u6240\u6709\u7684Vue\u7ec4\u4ef6\u3001JavaScript\u6587\u4ef6\u3001CSS\u6587\u4ef6\u548c\u56fe\u7247\u7b49\u8d44\u6e90\u6253\u5305\u6210\u4e00\u4e2a\u6216\u591a\u4e2aJavaScript\u6587\u4ef6\uff0c\u7136\u540e\u5728\u6d4f\u89c8\u5668\u4e2d\u52a0\u8f7d\u8fd9\u4e9b\u6587\u4ef6\u4ee5\u8fd0\u884c\u5e94\u7528\u7a0b\u5e8f\u3002\u8fd9\u4e2a\u6253\u5305\u8fc7\u7a0b\u662f\u7531webpack\u5b8c\u6210\u7684\uff0cwebpack\u662f\u4e00\u4e2a\u6d41\u884c\u7684JavaScrip<a href=\"https:\/\/exe.yimenapp.com\/tool-2658.html\">centos\u5b89\u88c5rpm<\/a>t\u6a21\u5757\u6253\u5305\u5668\uff0c\u5b83\u53ef\u4ee5\u5c06\u5404\u79cd\u7c7b\u578b\u7684\u6587\u4ef6\u6253\u5305\u6210JavaScript\u6587\u4ef6\u3002<\/p>\n<p>\u4e3a\u4e86\u5c06Vue\u9879\u76ee\u6253\u5305\u4e3a\u53ef\u6267<\/p>\n<p><figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/i.yimenyun.net\/2023-03\/21\/14\/34583518545.jpg\" \/><\/figure>\n<\/p>\n<p>\u884c\u6587\u4ef6\uff0c\u6211\u4eec\u9700\u8981\u4f7f\u7528Electron\u3002Electron\u662f\u4e00\u4e2a\u57fa\u4e8eChromium\u548cNode.js\u7684\u6846\u67b6\uff0c\u7528\u4e8e\u6784\u5efa\u8de8\u5e73\u53f0\u684c\u9762\u5e94\u7528\u7a0b\u5e8f\u3002\u4f7f\u7528Electron\uff0c\u6211\u4eec\u53ef\u4ee5\u5c06Vue\u9879\u76ee\u6253\u5305\u6210\u4e00\u4e2a\u53ef\u6267\u884c\u6587\u4ef6\uff0c\u4ee5\u5728Windows\u3001Mac\u548cLinux\u7b49\u64cd\u4f5c\u7cfb\u7edf\u4e0a\u8fd0\u884c\u3002<\/p>\n<p>\u4e0b\u9762\u662f\u8be6\u7ec6\u7684\u6b65\u9aa4\uff1a<\/p>\n<p>1. \u521b\u5efa\u4e00\u4e2aElectron\u9879\u76ee<\/p>\n<p>\u9996\u5148\uff0c\u6211\u4eec\u9700\u8981\u521b\u5efa\u4e00\u4e2aElectron\u9879\u76ee\u3002\u4f60\u53ef\u4ee5\u4f7f\u7528\u547d\u4ee4\u884c\u5de5\u5177\u6216Electron Forge\u7b49\u5de5\u5177\u6765\u521b\u5efa\u4e00\u4e2aElectron\u9879\u76ee\u3002\u5728\u521b\u5efa\u9879\u76ee\u65f6\uff0c\u786e\u4fdd\u5c06Vue\u9879\u76ee\u7684\u6e90\u4ee3\u7801\u590d\u5236\u5230Electron\u9879\u76ee\u7684\u76ee\u5f55\u4e2d\u3002<\/p>\n<p>2. \u914d\u7f6eElectron\u9879\u76ee<\/p>\n<p>\u63a5\u4e0b\u6765\uff0c\u6211\u4eec\u9700\u8981\u914d\u7f6eElectron\u9879\u76ee\u4ee5\u52a0\u8f7dVue\u5e94\u7528\u7a0b\u5e8f\u3002\u6253\u5f00Electron\u9879\u76ee\u7684main.js\u6587\u4ef6\uff0c\u5e76\u6dfb\u52a0\u4ee5\u4e0b\u4ee3\u7801\uff1a<\/p>\n<p>&#8220;`<\/p>\n<p>const { app, BrowserWindow } = require(&#8216;electron&#8217;)<\/p>\n<p>const path = require(&#8216;path&#8217;)<\/p>\n<p>function createWindow () {<\/p>\n<p>  const win = new BrowserWindow({<\/p>\n<p>    width: 800,<\/p>\n<p>    height: 600,<\/p>\n<p>    webPreferences: {<\/p>\n<p>      nodeIntegration: true<\/p>\n<p>    }<\/p>\n<p>  })<\/p>\n<p>  win.loadFile(&#8216;index.html&#8217;)<\/p>\n<p>}<\/p>\n<p>app.whenReady().then(() =&gt;<a href=\"https:\/\/exe.yimenapp.com\/tool-1103.html\">exe\u6253\u5305\u4e3awindow\u670d\u52a1<\/a> {<\/p>\n<p>  createWindow()<\/p>\n<p>  app.on(&#8216;activate&#8217;, () =&gt; {<\/p>\n<p>    if (BrowserWindow.getAllWindows().length === 0) {<\/p>\n<p>      createWindow()<\/p>\n<p>    }<\/p>\n<p>  })<\/p>\n<p>})<\/p>\n<p>app.on(&#8216;window-all-closed&#8217;, () =&gt; {<\/p>\n<p>  if (process.platform !== &#8216;darwin&#8217;) {<\/p>\n<p>    app.quit()<\/p>\n<p>  }<\/p>\n<p>})<\/p>\n<p>&#8220;`<\/p>\n<p>\u8fd9\u6bb5\u4ee3\u7801\u5c06\u521b\u5efa\u4e00\u4e2aElectron\u7a97\u53e3\uff0c\u5e76\u52a0\u8f7dVue\u5e94\u7528\u7a0b\u5e8f\u7684\u5165\u53e3\u6587\u4ef6index.html\u3002\u786e\u4fdd\u5c06index.html\u6587\u4ef6\u653e\u5728Electron\u9879\u76ee\u7684\u6839\u76ee\u5f55\u4e2d\u3002<\/p>\n<p>3. \u5b89\u88c5\u4f9d\u8d56\u9879<\/p>\n<p>\u63a5\u4e0b\u6765\uff0c\u6211\u4eec\u9700\u8981\u5b89\u88c5\u4e00\u4e9b\u4f9d\u8d56\u9879\u3002\u5728Electron\u9879\u76ee\u7684\u6839\u76ee\u5f55\u4e2d\u6253\u5f00\u7ec8\u7aef\uff0c\u5e76\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<p>&#8220;`<\/p>\n<p>npm install &#8211;save-dev electron-builder<\/p>\n<p>&#8220;`<\/p>\n<p>\u8fd9\u5c06\u5b89\u88c5electron-builder\uff0c\u4e00\u4e2a\u7528\u4e8e\u6784\u5efaElectron\u5e94\u7528\u7a0b\u5e8f\u7684\u5de5\u5177\u3002<\/p>\n<p>4. \u914d\u7f6e\u6253\u5305\u9009\u9879<\/p>\n<p>\u5728Electron\u9879\u76ee\u7684\u6839\u76ee\u5f55\u4e2d\u521b\u5efa\u4e00\u4e2aelectron-builder.yml\u6587\u4ef6\uff0c\u5e76\u6dfb\u52a0\u4ee5\u4e0b\u4ee3\u7801\uff1a<\/p>\n<p>&#8220;`<\/p>\n<p>appId: com.example.myapp<\/p>\n<p>productName: My App<\/p>\n<p>directories:<\/p>\n<p>  output: dist<\/p>\n<p>  buildResources: assets<\/p>\n<p>files:<\/p>\n<p>  &#8211; &#8216;**\/*&#8217;<\/p>\n<p>  &#8211; !node_modules\/**\/* <\/p>\n<p>  &#8211; !src\/**\/* <\/p>\n<p>publish:<\/p>\n<p>  provider: github<\/p>\n<p>&#8220;`<\/p>\n<p>\u8fd9\u5c06\u914d\u7f6e\u6253\u5305\u9009\u9879\uff0c\u5305\u62ec\u5e94\u7528\u7a0b\u5e8f\u7684\u540d\u79f0\u3001ID\u3001\u8f93\u51fa\u76ee\u5f55\u548c\u6784\u5efa\u8d44\u6e90\u76ee\u5f55\u7b49\u3002<\/p>\n<p>5. \u6253\u5305\u5e94\u7528\u7a0b\u5e8f<\/p>\n<p>\u6700\u540e\uff0c\u6211\u4eec\u9700\u8981\u4f7f\u7528electron-builder\u6765\u6253\u5305\u5e94\u7528\u7a0b\u5e8f\u3002\u5728Electron\u9879\u76ee\u7684\u6839\u76ee\u5f55\u4e2d\u6253\u5f00\u7ec8\u7aef\uff0c\u5e76\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<p>&#8220;`<\/p>\n<p>npm run electron:build<\/p>\n<p>&#8220;`<\/p>\n<p>\u8fd9\u5c06\u4f7f\u7528electron-builder\u6765\u6253\u5305\u5e94\u7528\u7a0b\u5e8f\uff0c\u5e76\u5c06\u8f93\u51fa\u6587\u4ef6\u4fdd\u5b58\u5728dist\u76ee\u5f55\u4e2d\u3002<\/p>\n<p>\u603b\u7ed3\uff1a<\/p>\n<p>\u5728\u672c\u6587\u4e2d\uff0c\u6211\u4eec\u5b66\u4e60\u4e86\u5982\u4f55\u5c06Vue\u9879\u76ee\u6253\u5305\u4e3a\u53ef\u6267\u884c\u6587\u4ef6\u3002\u6211\u4eec\u4e86\u89e3\u4e86Vue\u9879\u76ee\u7684\u6253\u5305\u539f\u7406\uff0c\u4ee5\u53ca\u5982\u4f55\u4f7f\u7528Electron\u6765\u6784\u5efa\u8de8\u5e73\u53f0\u684c\u9762\u5e94\u7528\u7a0b\u5e8f\u3002\u901a\u8fc7\u6309\u7167\u4ee5\u4e0a\u6b65\u9aa4\uff0c\u60a8\u53ef\u4ee5\u5c06Vue\u9879\u76ee\u6253\u5305\u4e3a\u53ef\u6267\u884c\u6587\u4ef6\uff0c\u5e76\u5728Windows\u3001Mac\u548cLinux\u7b49\u64cd\u4f5c\u7cfb\u7edf\u4e0a\u8fd0\u884c\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Vue\u662f\u4e00\u79cd\u6d41\u884c\u7684JavaScript\u6846\u67b6\uff0c\u7528\u4e8e\u6784\u5efa\u5355\u9875\u5e94\u7528\u7a0b\u5e8f\u3002\u5f53\u4f60\u5b8c\u6210\u4e86\u4e00\u4e2aVue\u9879\u76ee\u540e\uff0c\u4f60\u53ef\u80fd\u60f3\u5c06\u5b83\u6253\u5305\u6210\u4e00\u4e2a\u53ef\u6267\u884c\u6587\u4ef6\uff08exe\uff09\u4ee5\u4fbf\u5728\u5176\u4ed6\u8ba1\u7b97\u673a\u4e0a\u8fd0\u884c\u3002\u5728\u672c\u6587\u4e2d\uff0c\u6211\u4eec\u5c06\u6df1\u5165\u63a2\u8ba8\u5982\u4f55\u5c06Vue\u9879<\/p>\n","protected":false},"author":15,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[1672,84,27144,132,728],"topic":[],"class_list":["post-23775","post","type-post","status-publish","format-standard","hentry","category-kaifaexe","tag-exe","tag-84","tag-execom","tag-132","tag-728"],"_links":{"self":[{"href":"https:\/\/app.60day.cn\/appday\/wp-json\/wp\/v2\/posts\/23775","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/app.60day.cn\/appday\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/app.60day.cn\/appday\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/app.60day.cn\/appday\/wp-json\/wp\/v2\/users\/15"}],"replies":[{"embeddable":true,"href":"https:\/\/app.60day.cn\/appday\/wp-json\/wp\/v2\/comments?post=23775"}],"version-history":[{"count":1,"href":"https:\/\/app.60day.cn\/appday\/wp-json\/wp\/v2\/posts\/23775\/revisions"}],"predecessor-version":[{"id":23821,"href":"https:\/\/app.60day.cn\/appday\/wp-json\/wp\/v2\/posts\/23775\/revisions\/23821"}],"wp:attachment":[{"href":"https:\/\/app.60day.cn\/appday\/wp-json\/wp\/v2\/media?parent=23775"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/app.60day.cn\/appday\/wp-json\/wp\/v2\/categories?post=23775"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/app.60day.cn\/appday\/wp-json\/wp\/v2\/tags?post=23775"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/app.60day.cn\/appday\/wp-json\/wp\/v2\/topic?post=23775"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}