{"id":161,"date":"2023-05-26T15:50:45","date_gmt":"2023-05-26T07:50:45","guid":{"rendered":"https:\/\/h5app.yimenapp.cn\/h5app\/?p=161"},"modified":"2023-05-26T15:50:45","modified_gmt":"2023-05-26T07:50:45","slug":"elementui%e6%89%93%e5%8c%85%e6%88%90exe%e6%9c%89%e4%bb%80%e4%b9%88%e4%bc%98%e5%8a%bf","status":"publish","type":"post","link":"https:\/\/h5app.yimenapp.cn\/h5app\/2023\/ruanjiankf\/161\/","title":{"rendered":"elementui\u6253\u5305\u6210exe\u6709\u4ec0\u4e48\u4f18\u52bf?"},"content":{"rendered":"<p>Element UI\u662f\u4e00\u4e2a\u57fa\u4e8eVue.js\u7684\u7ec4\u4ef6\u5e93\uff0c\u5b83\u63d0\u4f9b\u4e86\u4e00\u7cfb\u5217\u4e30\u5bcc\u7684UI\u7ec4\u4ef6\uff0c\u4e3a\u5f00\u53d1\u8005\u63d0\u4f9b\u4e86\u5feb\u901f\u6784\u5efaWeb\u5e94\u7528\u7684\u5de5\u5177\u3002\u4f46\u662f\uff0c\u5982\u679c\u6211\u4eec\u9700\u8981\u5c06Element UI\u6253\u5305\u6210exe\u6587\u4ef6\uff0c\u8be5\u600e\u4e48\u5b9e\u73b0\u5462\uff1f\u4e0b\u9762\u662f\u4e00\u4e9b\u8be6\u7ec6\u4ecb\u7ecd\u548c\u539f\u7406\uff1a<\/p>\n<p>\u4e00\u3001\u4ecb\u7ecd<\/p>\n<p>\u5c06Element UI\u6253\u5305\u6210exe\u6587\u4ef6\u7684\u4e3b\u8981\u76ee\u7684\u662f\u4e3a\u4e86\u65b9\u4fbf\u7528\u6237\u4f7f\u7528\uff0c\u4f7f\u5f97\u7528\u6237<a href=\"https:\/\/exe.yimenapp.com\/tool-1250.html\">dat\u6253\u5305\u5de5\u5177<\/a>\u53ef\u4ee5\u76f4\u63a5\u8fd0\u884c\u5e94\u7528\u7a0b\u5e8f\u800c\u4e0d\u9700\u8981\u5b89\u88c5\u4efb<a href=\"https:\/\/exe.yimenapp.com\/tool-99.html\">\u684c\u9762\u8f6f\u4ef6\u5f00\u53d1<\/a>\u4f55\u4f9d\u8d56\u3002\u8fd9\u79cd\u6253\u5305\u65b9\u5f0f\u53ef\u4ee5\u5c06\u6240\u6709\u7684\u4f9d\u8d56\u9879\u3001\u8d44\u6e90\u6587\u4ef6\u548c\u4ee3\u7801\u90fd\u6253\u5305\u5728\u4e00\u8d77\uff0c\u5f62\u6210\u4e00\u4e2a\u72ec\u7acb\u7684\u53ef\u6267\u884c\u6587\u4ef6\uff0c\u7528\u6237\u53ea\u9700\u8981\u53cc\u51fb\u8be5\u6587\u4ef6\u5c31\u53ef\u4ee5\u76f4\u63a5\u8fd0\u884c\u5e94\u7528\u7a0b\u5e8f\u3002<\/p>\n<p>\u4e8c\u3001\u539f\u7406<\/p>\n<p>\u5c06Element UI\u6253\u5305\u6210exe\u6587\u4ef6\u7684\u8fc7\u7a0b\u4e3b\u8981\u5206\u4e3a\u4e24\u4e2a\u6b65\u9aa4\uff1a<\/p>\n<p>1.\u5c06Element UI\u4ee3\u7801\u548c\u4f9d\u8d56\u9879\u6253\u5305\u6210\u4e00\u4e2a\u53ef\u6267\u884c\u6587\u4ef6<\/p>\n<p>\u8fd9\u4e2a\u6b65\u9aa4\u9700\u8981\u4f7f\u7528\u4e00\u4e9b\u5de5\u5177\u6765\u5b9e\u73b0\uff0c\u6bd4\u5982Electron\u3001NW.js\u7b49\u3002\u8fd9\u4e9b\u5de5\u5177\u53ef\u4ee5\u5c06Web\u5e94\u7528\u7a0b\u5e8f\u6253\u5305\u6210\u4e00\u4e2a\u53ef\u6267\u884c\u6587\u4ef6\uff0c\u540c\u65f6\u8fd8\u53ef\u4ee5\u5c06Node.js\u548cChromium\u5f15\u64ce\u6253\u5305\u5728\u4e00\u8d77\uff0c\u4f7f\u5f97\u5e94\u7528\u7a0b\u5e8f\u53ef\u4ee5\u76f4\u63a5\u8fd0\u884c\uff0c\u800c\u4e0d\u9700\u8981\u4f9d\u8d56\u5176\u4ed6\u73af\u5883\u3002<\/p>\n<p>2.\u5c06\u53ef\u6267\u884c\u6587\u4ef6\u548c\u8d44\u6e90\u6587\u4ef6\u6253\u5305\u6210\u4e00\u4e2a\u5b89\u88c5\u7a0b\u5e8f<\/p>\n<p>\u8fd9\u4e2a\u6b65\u9aa4\u9700\u8981\u4f7f\u7528\u4e00\u4e9b\u5b89\u88c5\u7a0b\u5e8f\u5236\u4f5c\u5de5\u5177\uff0c\u6bd4\u5982Inno Setup\u3001NSIS\u7b49\u3002\u8fd9\u4e9b\u5de5\u5177\u53ef\u4ee5\u5c06\u53ef\u6267\u884c\u6587\u4ef6\u548c\u8d44\u6e90\u6587\u4ef6\u6253\u5305\u6210\u4e00\u4e2a\u5b89\u88c5\u7a0b\u5e8f\uff0c\u4f7f\u5f97\u7528\u6237\u53ef\u4ee5\u76f4\u63a5\u8fd0\u884c\u5b89\u88c5\u7a0b\u5e8f\uff0c\u5b89\u88c5\u5e94\u7528\u7a0b\u5e8f\u5230\u672c\u5730\u8ba1\u7b97\u673a\u4e2d\u3002<\/p>\n<p>\u4e09\u3001\u6b65\u9aa4<\/p>\n<p>1.\u5b89\u88c5Node.js\u548cnpm<\/p>\n<p>Node.js\u548cnpm\u662f\u5f00\u53d1Electron\u5e94\u7528\u7a0b\u5e8f\u7684\u5fc5\u5907\u5de5\u5177\uff0c\u5982\u679c\u4f60\u8fd8\u6ca1\u6709\u5b89\u88c5\uff0c\u53ef\u4ee5\u5230\u5b98\u7f51\u4e0b\u8f7d\u5b89\u88c5\u3002<\/p>\n<p>2.\u521b\u5efa\u4e00\u4e2aElectron\u9879\u76ee<\/p>\n<p>\u5728\u547d\u4ee4\u884c\u4e2d\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<p>&#8220;`<\/p>\n<p>mkdir my-electron-app<\/p>\n<p>cd my-electron-app<\/p>\n<p>npm init -y<\/p>\n<p>npm install electron &#8211;save-dev<\/p>\n<p>&#8220;`<\/p>\n<p>\u8fd9\u4e2a\u547d\u4ee4\u4f1a\u521b\u5efa\u4e00\u4e2a\u65b0\u7684Electron\u9879\u76ee\uff0c\u5e76\u4e14\u5b89\u88c5Electron\u4f9d\u8d56\u9879\u3002<\/p>\n<p>3.\u521b\u5efa\u4e00\u4e2aElectron\u4e3b\u8fdb\u7a0b<\/p>\n<p>\u5728\u9879\u76ee\u6839\u76ee\u5f55\u4e0b\u521b\u5efa\u4e00\u4e2a\u540d\u4e3amain.js\u7684\u6587\u4ef6\uff0c\u8fd9\u4e2a\u6587\u4ef6\u662fElectron\u7684\u4e3b\u8fdb\u7a0b\uff0c\u7528\u6765\u52a0\u8f7dWeb\u5e94\u7528\u7a0b\u5e8f\u5e76\u4e14\u521b\u5efa\u7a97\u53e3\u3002<\/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>  win.webContents.openDevTools()<\/p>\n<p>}<\/p>\n<p>app.whenReady().then(() =&gt; {<\/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\u4e2a\u4ee3\u7801\u4f1a\u521b\u5efa\u4e00\u4e2a\u7a97\u53e3\uff0c\u5e76\u4e14\u52a0\u8f7dindex.html\u6587\u4ef6\u3002<\/p>\n<p>4.\u521b\u5efa\u4e00\u4e2aindex.html\u6587\u4ef6<\/p>\n<p>\u5728\u9879\u76ee\u6839\u76ee\u5f55\u4e0b\u521b\u5efa\u4e00\u4e2a\u540d\u4e3aindex.html\u7684\u6587\u4ef6\uff0c\u8fd9\u4e2a\u6587\u4ef6\u662fWeb\u5e94\u7528\u7a0b\u5e8f\u7684\u5165\u53e3\u6587\u4ef6\uff0c\u7528\u6765\u52a0\u8f7dElement UI\u7ec4\u4ef6\u548c\u5176\u4ed6\u8d44\u6e90\u6587\u4ef6\u3002<\/p>\n<p>&#8220;`<\/p>\n<\/p>\n<p>\n<p>\n<p>    <title>My Element UI App<\/title><\/p>\n<\/p>\n<p>\n<p>\n<p>      Click Me<\/p>\n<\/p>\n<\/p>\n<p>      var app = new Vue({<\/p>\n<p>        el: &#8216;#app&#8217;<\/p>\n<p>      })<\/p>\n<\/p>\n<\/p>\n<p>&#8220;`<\/p>\n<p>\u8fd9\u4e2a\u4ee3\u7801\u4f1a\u52a0\u8f7dElement UI\u7ec4\u4ef6\u548c\u5176\u4ed6\u8d44\u6e90\u6587\u4ef6\uff0c\u5e76\u4e14\u521b\u5efa\u4e00\u4e2aVue\u5b9e\u4f8b\u3002<\/p>\n<p>5.\u8fd0\u884cElectron\u5e94\u7528\u7a0b\u5e8f<\/p>\n<p>\u5728\u547d\u4ee4\u884c\u4e2d\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<p>&#8220;<\/p>\n<p><figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/i.cdn.yimenapp.com\/2023-03\/15\/10\/21800186236.jpg\" \/><\/figure>\n<\/p>\n<p>`<\/p>\n<p>npm start<\/p>\n<p>&#8220;`<\/p>\n<p>\u8fd9\u4e2a\u547d\u4ee4\u4f1a\u542f\u52a8Electron\u5e94\u7528\u7a0b\u5e8f\uff0c\u5e76\u4e14\u6253\u5f00\u4e00\u4e2a\u7a97\u53e3\uff0c\u663e\u793aElement UI\u7ec4\u4ef6\u3002<\/p>\n<p>6.\u6253\u5305\u5e94\u7528\u7a0b\u5e8f<\/p>\n<p>\u5728\u547d\u4ee4\u884c\u4e2d\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<p>&#8220;`<\/p>\n<p>npm install electron-packager &#8211;save-dev<\/p>\n<p>&#8220;`<\/p>\n<p>\u8fd9\u4e2a\u547d\u4ee4\u4f1a\u5b89\u88c5electron-packager\u4f9d\u8d56\u9879\uff0c\u7528\u6765\u6253\u5305Electron\u5e94\u7528\u7a0b\u5e8f\u3002<\/p>\n<p>\u7136\u540e\uff0c\u5728\u547d\u4ee4\u884c\u4e2d\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<p>&#8220;`<\/p>\n<p>npx electron-packager . my-electron-app &#8211;platform=win32 &#8211;arch=x64 &#8211;icon=icon.ico &#8211;overwrite<\/p>\n<p>&#8220;`<\/p>\n<p>\u8fd9\u4e2a\u547d\u4ee4\u4f1a\u5c06Electron\u5e94\u7528\u7a0b\u5e8f\u6253\u5305\u6210\u4e00\u4e2aexe\u6587\u4ef6\uff0c\u5e76\u4e14\u5c06\u6240\u6709\u7684\u4f9d\u8d56\u9879\u3001\u8d44\u6e90\u6587\u4ef6\u548c\u4ee3\u7801\u90fd\u6253\u5305\u5728\u4e00\u8d77\u3002<\/p>\n<p>7.\u521b\u5efa\u5b89\u88c5\u7a0b\u5e8f<\/p>\n<p>\u5728\u547d\u4ee4\u884c\u4e2d\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<p>&#8220;`<\/p>\n<p>npm install electron-winstaller &#8211;save-dev<\/p>\n<p>&#8220;`<\/p>\n<p>\u8fd9\u4e2a\u547d\u4ee4\u4f1a\u5b89\u88c5electron-winstaller\u4f9d\u8d56\u9879\uff0c\u7528\u6765\u521b\u5efa\u5b89\u88c5\u7a0b\u5e8f\u3002<\/p>\n<p>\u7136\u540e\uff0c\u5728\u547d\u4ee4\u884c\u4e2d\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<p>&#8220;`<\/p>\n<p>npx electron-winstaller .\\my-electron-app\\ &#8211;out=out &#8211;overwrite &#8211;icon=icon.ico<\/p>\n<p>&#8220;`<\/p>\n<p>\u8fd9\u4e2a\u547d\u4ee4\u4f1a\u5c06exe\u6587\u4ef6\u548c\u8d44\u6e90\u6587\u4ef6\u6253\u5305\u6210\u4e00\u4e2a\u5b89\u88c5\u7a0b\u5e8f\uff0c\u5e76\u4e14\u5c06\u5b89\u88c5\u7a0b\u5e8f\u8f93\u51fa\u5230out\u6587\u4ef6\u5939\u4e2d\u3002<\/p>\n<p>\u6700\u540e\uff0c\u7528\u6237\u53ef\u4ee5\u76f4\u63a5\u8fd0\u884c\u5b89\u88c5<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Element UI\u662f\u4e00\u4e2a\u57fa\u4e8eVue.js\u7684\u7ec4\u4ef6\u5e93\uff0c\u5b83\u63d0\u4f9b\u4e86\u4e00\u7cfb\u5217\u4e30\u5bcc\u7684UI\u7ec4\u4ef6\uff0c\u4e3a\u5f00\u53d1\u8005\u63d0\u4f9b\u4e86\u5feb\u901f\u6784\u5efaWeb\u5e94\u7528\u7684\u5de5\u5177\u3002\u4f46\u662f\uff0c\u5982\u679c\u6211\u4eec\u9700\u8981\u5c06Element UI\u6253\u5305\u6210exe\u6587\u4ef6\uff0c\u8be5\u600e\u4e48\u5b9e\u73b0\u5462\uff1f\u4e0b\u9762<\/p>\n","protected":false},"author":15,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[393,394,395,11,81],"topic":[],"class_list":["post-161","post","type-post","status-publish","format-standard","hentry","category-ruanjiankf","tag-apk","tag-exe","tag-395","tag-11","tag-81"],"_links":{"self":[{"href":"https:\/\/h5app.yimenapp.cn\/h5app\/wp-json\/wp\/v2\/posts\/161","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/h5app.yimenapp.cn\/h5app\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/h5app.yimenapp.cn\/h5app\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/h5app.yimenapp.cn\/h5app\/wp-json\/wp\/v2\/users\/15"}],"replies":[{"embeddable":true,"href":"https:\/\/h5app.yimenapp.cn\/h5app\/wp-json\/wp\/v2\/comments?post=161"}],"version-history":[{"count":0,"href":"https:\/\/h5app.yimenapp.cn\/h5app\/wp-json\/wp\/v2\/posts\/161\/revisions"}],"wp:attachment":[{"href":"https:\/\/h5app.yimenapp.cn\/h5app\/wp-json\/wp\/v2\/media?parent=161"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/h5app.yimenapp.cn\/h5app\/wp-json\/wp\/v2\/categories?post=161"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/h5app.yimenapp.cn\/h5app\/wp-json\/wp\/v2\/tags?post=161"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/h5app.yimenapp.cn\/h5app\/wp-json\/wp\/v2\/topic?post=161"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}