1\u3001\u9996\u5148\uff0c\u521b\u5efa\u4e00\u4e2a Electron \u9879\u76ee\uff1a<\/p>\n
electron-forge init [\u7a0b\u5e8f\u540d]<\/pre>\nelectron-forge \u4f1a\u4e3a\u6211\u4eec\u751f\u6210 packege.json \u6587\u4ef6\u4ee5\u53ca src \u76ee\u5f55\uff0c\u5e76\u5b89\u88c5\u597d\u76f8\u5173\u7684 Node.js \u4f9d\u8d56\u5e93\u3002src \u76ee\u5f55\u4e0b\u6709\u4e24\u4e2a\u6587\u4ef6 index.html \u548c index.js\uff0cindex.html \u662f\u4e00\u4e2a\u666e\u901a\u7684 HTML \u9875\u9762\uff0c\u800c index.js \u662f\u5728 package.json \u6587\u4ef6\u4e2d\u6307\u5b9a\u7684\u7a0b\u5e8f\u5165\u53e3\uff0c\u5e76\u4e14 electron-forge \u4f1a\u4e3a\u6211\u4eec\u751f\u6210\u6a21\u677f\u4ee3\u7801\u4ee5\u53ca\u76f8\u5173\u7684\u6ce8\u91ca\uff0c\u53ef\u4ee5\u6839\u636e\u6ce8\u91ca\u4e86\u89e3\u76f8\u5173\u7684\u4ee3\u7801\u4f5c\u7528\u3002<\/p>\n
\u63a5\u4e0b\u6765\uff0c\u6211\u4eec\u4f7f\u7528 HTML+CSS \u77e5\u8bc6\u753b\u4e00\u4e2a\u65f6\u949f\u8868\u76d8\uff0c\u56e0\u4e3a\u76f8\u5bf9\u672c\u6587\u7684\u5185\u5bb9\uff0c\u8fd9\u90e8\u5206\u4e0d\u662f\u5173\u952e\uff0c\u6240\u4ee5\u5728\u6b64\u5148\u7701\u7565\uff0c\u672c\u6587\u7684\u4ee3\u7801\u90fd\u4f1a\u5728\u6587\u672b\u516c\u5e03\uff0c\u4f9b\u5927\u5bb6\u53c2\u8003\u3002<\/p>\n
\u7136\u540e\uff0c\u6211\u4eec\u9700\u8981\u8ba9\u8868\u76d8\u4e0a\u7684\u6307\u9488\u52a8\u8d77\u6765\uff0c\u5728 index.html \u4e2d\u5f15\u5165 clock.js \u6587\u4ef6\uff0c\u6dfb\u52a0 JavaScript \u4ee3\u7801\u8ba9\u5176\u63a7\u5236\u6307\u9488\u7684\u8fd0\u52a8\uff0c\u4ee5\u79d2\u9488\u4e3a\u4f8b\uff1a<\/p>\n
const second = today.getSeconds(); \/\/ \u83b7\u53d6\u5f53\u524d\u65f6\u95f4\r\nconst secondDeg = ((second \/ 60) * 360) + 360; \/\/ \u8ba1\u7b97\u79d2\u9488\u8fd0\u52a8\u89d2\u5ea6\r\nsecondHand.style.transform = `rotate(${secondDeg}deg)`; \/\/ \u6dfb\u52a0 CSS \u52a8\u753b<\/pre>\n\u6700\u540e\uff0c\u6211\u4eec\u8c03\u6574 index.js\uff0c\u8c03\u7528 new BrowserWindow() \u751f\u6210 window \u5bf9\u8c61\u7684\u65f6\u5019\uff0c\u5b83\u7684\u5bbd\u5ea6\u548c\u9ad8\u5ea6\u8981\u6839\u636e\u8868\u76d8\u7684\u5927\u5c0f\u4f5c\u76f8\u5e94\u7684\u8c03\u6574\uff0c\u5c06 transprent \u5b57\u6bb5\u8d4b\u503c\u4e3a true\u3001frame \u4e3a false\uff0c\u4f7f\u4f60\u7684\u7a0b\u5e8f\u65e0\u8fb9\u6846\u5e76\u4e14\u80cc\u666f\u4fdd\u6301\u900f\u660e\uff1b\u5e76\u4e14\u9700\u8981\u5bf9new BrowserWindow() \u7684\u64cd\u4f5c\u4f5c\u5ef6\u8fdf\u5904\u7406\uff0c\u8fd9\u6837\u4f60\u7684\u900f\u660e\u5316\u64cd\u4f5c\u624d\u4f1a\u751f\u6548\uff1a<\/p>\n
app.on('ready', () => setTimeout(createWindow, 500));<\/pre>\n\u5e94\u7528\u8fd0\u884c\u4ee5\u53ca\u6253\u5305\u53d1\u5e03<\/strong><\/div>\n\u7f16\u7801\u5b8c\u6210\u4e4b\u540e\uff0c\u8fd0\u884c\u5e94\u7528\u4e5f\u662f\u975e\u5e38\u7b80\u5355\uff0c\u5728\u5de5\u7a0b\u76ee\u5f55\u4e0b\u8fd0\u884c\u547d\u4ee4 electron-forge start \u5373\u53ef\u3002<\/p>\n
\u90a3\u4e48\u5982\u4f55\u5728\u4f18\u9e92\u9e9f\u4e0a\u5bf9\u5e94\u7528\u8fdb\u884c\u6253\u5305\u53d1\u5e03\u5462\uff1f\u9996\u5148\u6211\u4eec\u4fee\u6539 package.json \u6587\u4ef6\uff0c\u627e\u5230 make_targets \u5b57\u6bb5\uff0c\u5728 linux \u4e0b\uff0c\u6211\u4eec\u5220\u9664\u6389 rpm\uff0c\u56e0\u4e3a\u6211\u4eec\u7684\u4f18\u9e92\u9e9f\u91c7\u7528\u7684\u662f debian \u7684\u6253\u5305\u4f53\u7cfb\uff0c\u4e4b\u540e\u5728\u5de5\u7a0b\u76ee\u5f55\u8fd0\u884c\u547d\u4ee4 electron-forge make\uff0c\u5373\u53ef\u5b8c\u6210\u53d1\u5e03\u3002\u6ce8\u610f\u53d1\u5e03\u540e\u751f\u6210\u4e8c\u8fdb\u5236\u6587\u4ef6\u548c deb \u5305\u90fd\u5728 out \u76ee\u5f55\u4e0b\u3002\u7a0b\u5e8f\u6700\u540e\u7684\u6548\u679c\u5982\u4e0b\uff1a <\/p>\n
<\/p>\n
\u603b\u7ed3<\/strong><\/div>\n\u4f7f\u7528 Electron \u6765\u5f00\u53d1\u684c\u9762\u7a0b\u5e8f\u662f\u4e0d\u662f\u53c8\u5feb\u53c8\u597d\u5462\uff0c\u5927\u5bb6\u53ef\u4ee5\u8bd5\u8bd5\u540c\u6837\u4e00\u4e2a\u65f6\u949f\u8868\u76d8\u684c\u9762\u5e94\u7528\uff0c\u4f7f\u7528 Gtk \u6216\u8005 Qt \u5f00\u53d1\u8981\u82b1\u591a\u5c11\u65f6\u95f4\uff0c\u624d\u80fd\u771f\u6b63\u4f53\u4f1a Electron \u5e26\u6765\u7684\u662f\u4ec0\u4e48\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"
\u4f7f\u7528 Web \u6807\u51c6\u6765\u521b\u5efa\u684c\u9762 GUI\uff0c\u4e0a\u624b\u5feb\u3001\u6210\u672c\u4f4e\u3001\u8de8\u5e73\u53f0\u3001\u81ea\u9002\u5e94\u5206\u8fa8\u7387\uff0c\u8fd9\u4e9b\u90fd\u662f Electron \u7684\u4f18\u52bf […]<\/p>\n","protected":false},"author":1482,"featured_media":144243,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-162869","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/162869","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/1482"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=162869"}],"version-history":[{"count":4,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/162869\/revisions"}],"predecessor-version":[{"id":162905,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/162869\/revisions\/162905"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/144243"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=162869"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=162869"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=162869"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}