{"id":544,"date":"2023-05-26T15:50:45","date_gmt":"2023-05-26T07:50:45","guid":{"rendered":"https:\/\/www.zhidianwl.com\/zhidian\/?p=544"},"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:\/\/www.zhidianwl.com\/zhidian\/2023\/544\/","title":{"rendered":"elementui\u6253\u5305\u6210exe\u6709\u4ec0\u4e48\u4f18\u52bf?"},"content":{"rendered":"
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
\u4e00\u3001\u4ecb\u7ecd<\/p>\n
\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\u6237dat\u6253\u5305\u5de5\u5177<\/a>\u53ef\u4ee5\u76f4\u63a5\u8fd0\u884c\u5e94\u7528\u7a0b\u5e8f\u800c\u4e0d\u9700\u8981\u5b89\u88c5\u4efb\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 \u4e8c\u3001\u539f\u7406<\/p>\n \u5c06Element UI\u6253\u5305\u6210exe\u6587\u4ef6\u7684\u8fc7\u7a0b\u4e3b\u8981\u5206\u4e3a\u4e24\u4e2a\u6b65\u9aa4\uff1a<\/p>\n 1.\u5c06Element UI\u4ee3\u7801\u548c\u4f9d\u8d56\u9879\u6253\u5305\u6210\u4e00\u4e2a\u53ef\u6267\u884c\u6587\u4ef6<\/p>\n \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 2.\u5c06\u53ef\u6267\u884c\u6587\u4ef6\u548c\u8d44\u6e90\u6587\u4ef6\u6253\u5305\u6210\u4e00\u4e2a\u5b89\u88c5\u7a0b\u5e8f<\/p>\n \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 \u4e09\u3001\u6b65\u9aa4<\/p>\n 1.\u5b89\u88c5Node.js\u548cnpm<\/p>\n 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 2.\u521b\u5efa\u4e00\u4e2aElectron\u9879\u76ee<\/p>\n \u5728\u547d\u4ee4\u884c\u4e2d\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n “`<\/p>\n mkdir my-electron-app<\/p>\n cd my-electron-app<\/p>\n npm init -y<\/p>\n npm install electron –save-dev<\/p>\n “`<\/p>\n \u8fd9\u4e2a\u547d\u4ee4\u4f1a\u521b\u5efa\u4e00\u4e2a\u65b0\u7684Electron\u9879\u76ee\uff0c\u5e76\u4e14\u5b89\u88c5Electron\u4f9d\u8d56\u9879\u3002<\/p>\n 3.\u521b\u5efa\u4e00\u4e2aElectron\u4e3b\u8fdb\u7a0b<\/p>\n \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>\n const { app, BrowserWindow } = require(‘electron’)<\/p>\n const path = require(‘path’)<\/p>\n function createWindow () {<\/p>\n const win = new BrowserWindow({<\/p>\n width: 800,<\/p>\n height: 600,<\/p>\n webPreferences: {<\/p>\n nodeIntegration: true<\/p>\n }<\/p>\n })<\/p>\n win.loadFile(‘index.html’)<\/p>\n win.webContents.openDevTools()<\/p>\n }<\/p>\n app.whenReady().then(() => {<\/p>\n createWindow()<\/p>\n app.on(‘activate’, () => {<\/p>\n if (BrowserWindow.getAllWindows().length === 0) {<\/p>\n createWindow()<\/p>\n }<\/p>\n })<\/p>\n })<\/p>\n app.on(‘window-all-closed’, () => {<\/p>\n if (process.platform !== ‘darwin’) {<\/p>\n app.quit()<\/p>\n }<\/p>\n })<\/p>\n “`<\/p>\n \u8fd9\u4e2a\u4ee3\u7801\u4f1a\u521b\u5efa\u4e00\u4e2a\u7a97\u53e3\uff0c\u5e76\u4e14\u52a0\u8f7dindex.html\u6587\u4ef6\u3002<\/p>\n 4.\u521b\u5efa\u4e00\u4e2aindex.html\u6587\u4ef6<\/p>\n \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>\n<\/p>\n \n \n \n \n Click Me<\/p>\n<\/p>\n<\/p>\n var app = new Vue({<\/p>\n el: ‘#app’<\/p>\n })<\/p>\n<\/p>\n<\/p>\n “`<\/p>\n \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 5.\u8fd0\u884cElectron\u5e94\u7528\u7a0b\u5e8f<\/p>\n \u5728\u547d\u4ee4\u884c\u4e2d\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n “<\/p>\n `<\/p>\n npm start<\/p>\n “`<\/p>\n \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 6.\u6253\u5305\u5e94\u7528\u7a0b\u5e8f<\/p>\n \u5728\u547d\u4ee4\u884c\u4e2d\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n “`<\/p>\n npm install electron-packager –save-dev<\/p>\n “`<\/p>\n \u8fd9\u4e2a\u547d\u4ee4\u4f1a\u5b89\u88c5electron-packager\u4f9d\u8d56\u9879\uff0c\u7528\u6765\u6253\u5305Electron\u5e94\u7528\u7a0b\u5e8f\u3002<\/p>\n \u7136\u540e\uff0c\u5728\u547d\u4ee4\u884c\u4e2d\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n “`<\/p>\n npx electron-packager . my-electron-app –platform=win32 –arch=x64 –icon=icon.ico –overwrite<\/p>\n “`<\/p>\n \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 7.\u521b\u5efa\u5b89\u88c5\u7a0b\u5e8f<\/p>\n \u5728\u547d\u4ee4\u884c\u4e2d\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n “`<\/p>\n npm install electron-winstaller –save-dev<\/p>\n “`<\/p>\n \u8fd9\u4e2a\u547d\u4ee4\u4f1a\u5b89\u88c5electron-winstaller\u4f9d\u8d56\u9879\uff0c\u7528\u6765\u521b\u5efa\u5b89\u88c5\u7a0b\u5e8f\u3002<\/p>\n \u7136\u540e\uff0c\u5728\u547d\u4ee4\u884c\u4e2d\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n “`<\/p>\n npx electron-winstaller .\\my-electron-app\\ –out=out –overwrite –icon=icon.ico<\/p>\n “`<\/p>\n \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 \u6700\u540e\uff0c\u7528\u6237\u53ef\u4ee5\u76f4\u63a5\u8fd0\u884c\u5b89\u88c5<\/p>\n","protected":false},"excerpt":{"rendered":" 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":23,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[1274,1275,543,14,171],"class_list":["post-544","post","type-post","status-publish","format-standard","hentry","category-zuoexe","tag-apk","tag-exe","tag-543","tag-14","tag-171"],"_links":{"self":[{"href":"https:\/\/www.zhidianwl.com\/zhidian\/wp-json\/wp\/v2\/posts\/544","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.zhidianwl.com\/zhidian\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.zhidianwl.com\/zhidian\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.zhidianwl.com\/zhidian\/wp-json\/wp\/v2\/users\/23"}],"replies":[{"embeddable":true,"href":"https:\/\/www.zhidianwl.com\/zhidian\/wp-json\/wp\/v2\/comments?post=544"}],"version-history":[{"count":0,"href":"https:\/\/www.zhidianwl.com\/zhidian\/wp-json\/wp\/v2\/posts\/544\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.zhidianwl.com\/zhidian\/wp-json\/wp\/v2\/media?parent=544"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.zhidianwl.com\/zhidian\/wp-json\/wp\/v2\/categories?post=544"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.zhidianwl.com\/zhidian\/wp-json\/wp\/v2\/tags?post=544"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}<\/figure>\n<\/p>\n