{"id":20466,"date":"2026-08-05T15:28:30","date_gmt":"2026-08-05T07:28:30","guid":{"rendered":"https:\/\/www.yimenyun.ltd\/ezhan\/?p=20466"},"modified":"2026-08-05T15:28:30","modified_gmt":"2026-08-05T07:28:30","slug":"%e6%8a%8a%e7%bd%91%e9%a1%b5%e6%89%93%e5%8c%85%e6%88%90%e5%ae%a2%e6%88%b7%e7%ab%af%e5%b0%b1%e7%94%a8%e4%b8%80%e9%97%a8","status":"publish","type":"post","link":"https:\/\/www.yimenyun.ltd\/ezhan\/20466\/","title":{"rendered":"\u628a\u7f51\u9875\u6253\u5305\u6210\u5ba2\u6237\u7aef\u5c31\u7528\u4e00\u95e8"},"content":{"rendered":"<p>\u5728\u4e92\u8054\u7f51\u65e5\u76ca\u53d1\u5c55\u7684\u4eca\u5929\uff0c\u8d8a\u6765\u8d8a\u591a\u7684\u5e94\u7528\u8fc1\u79fb\u5230\u4e86\u4e91\u7aef\u3002\u684c\u9762\u5e94\u7528\u9010\u6e10\u88ab\u5185\u5d4c Web \u6d4f\u89c8\u5668\u7684\u8f7b\u91cf\u7ea7\u5ba2\u6237\u7aef\u53d6\u4ee3\uff0c\u8fd9\u4e3a\u8de8\u5e73\u53f0\u5f00\u53d1\u5e26\u6765\u4e86\u5f88\u5927\u7684\u4fbf\u5229\u3002\u5c06\u7f51\u9875\u6253\u5305\u6210\u5ba2\u6237\u7aef\u5e94\u7528\uff0c\u4f7f\u7528\u6237\u65e0\u9700\u6253\u5f00\u6d4f\u89c8<a href=\"https:\/\/appfengzhuang.yimenapp.com\/app-822.html\">html5\u5f00\u53d1app<\/a>\u5668\u5373\u53ef\u4eab\u53d7\u5230\u4e30\u5bcc\u591a\u5f69\u7684\u7f51\u7edc\u670d\u52a1\u3002\u672c\u6587\u5c06\u4e3a\u60a8\u4ecb\u7ecd\u5c06\u7f51\u9875\u6253\u5305\u6210\u5ba2\u6237\u7aef\u7684\u539f\u7406\u548c\u8be6\u7ec6\u6b65\u9aa4\u3002<\/p>\n<p>\u4e00\u3001\u7f51\u9875\u5ba2\u6237\u7aef\u7684\u539f\u7406<\/p>\n<p>1. WebView \u6280\u672f<\/p>\n<p>WebView \u6280\u672f\u662f\u4e00\u4e2a\u5d4c\u5165\u5f0f<\/p>\n<p><figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/i.yimenyun.net\/2023-04\/07\/09\/25765822152.jpg\" \/><\/figure>\n<\/p>\n<p> Web \u6d4f\u89c8\u5668\u63a7\u4ef6\uff0c\u5b83\u53ef\u4ee5\u52a0\u8f7d HTML5 \u9875\u9762\uff0c\u4e3a\u5f00\u53d1\u4eba\u5458\u63d0\u4f9b\u4e86\u4e00\u79cd\u7b80\u4fbf\u3001\u9ad8\u6548\u5c06\u7f51\u9875\u5d4c\u5165\u5230\u539f\u751f\u5e94\u7528\u7a0b\u5e8f\u7684\u65b9\u6cd5\u3002WebView \u53ef\u4ee5\u5728\u5ba2\u6237\u7aef\u5185\u8fdb\u884c\u6e32\u67d3\uff0c\u4e0e\u670d\u52a1\u5668\u901a\u4fe1\uff0c\u8ba9\u7f51\u9875\u5728\u5ba2\u6237\u7aef\u5448\u73b0\u51fa\u6765\u3002<\/p>\n<p>2. Electron \u6846\u67b6<\/p>\n<p>Electron \u662f\u4e00\u4e2a\u5f00\u6e90\u6846\u67b6\uff0c\u4f7f\u7528 JavaScript\u3001HTML \u548c CSS \u7f16\u5199\u8de8\u5e73\u53f0\u684c\u9762\u5e94\u7528\u7a0b\u5e8f\u3002Electron \u53ef\u4ee5\u5c06 Web \u7f51\u9875\u5236\u4f5c\u4e3a\u4e00\u4e2a\u53ef\u72ec\u7acb\u8fd0\u884c\u7684\u64cd\u4f5c\u7cfb\u7edf\u5e94\u7528\u7a0b\u5e8f\uff0c\u8ba9\u7528\u6237\u65e0\u9700\u5b89\u88c5\u6d4f\u89c8\u5668\u5373\u53ef\u8bbf\u95ee\u7f51\u9875\u5e94\u7528\u3002<\/p>\n<p>\u4e8c\u3001\u7f51\u9875\u5ba2\u6237\u7aef\u7684\u5236\u4f5c\u6b65\u9aa4<\/p>\n<p>1. \u786e\u4fdd\u4f60\u7684\u7f51\u9875\u5177\u5907\u54cd\u5e94\u5f0f\u5e03\u5c40<\/p>\n<p>\u8981\u5c06\u7f51\u9875\u6253\u5305\u6210\u5ba2\u6237\u7aef\uff0c\u9996\u5148\u9700\u8981\u786e\u4fdd\u7f51\u9875\u5177\u5907\u54cd\u5e94\u5f0f\u5e03\u5c40\u548c\u81ea\u9002\u5e94\u5206\u8fa8\u7387\u529f\u80fd\u3002\u8fd9\u6837\u624d\u80fd\u5728\u7528\u6237\u7684\u64cd\u4f5c\u7cfb\u7edf\u4e0a\u4fdd\u6301\u826f\u597d\u7684\u4ea4\u4e92\u6027\u548c\u5e03\u5c40\u6548\u679c\u3002\u5982\u679c\u7f51\u9875\u8fd8\u4e0d\u5177\u5907\u8fd9\u4e9b\u7279\u6027\uff0c\u4f60\u9700\u8981\u5bf9\u7f51\u9875\u8fdb\u884c\u91cd\u65b0\u8bbe\u8ba1\u548c\u8c03\u6574\u3002<\/p>\n<p>2. \u4f7f\u7528 Electron \u6253\u5305\u7f51\u9875<\/p>\n<p>\u63a5\u4e0b\u6765\uff0c\u4f60\u9700\u8981\u4f7f\u7528 Electron \u6846\u67b6\u5c06\u7f51\u9875\u5d4c\u5165\u5230\u4e00\u4e2a\u72ec\u7acb\u7684\u53ef\u6267\u884c\u6587\u4ef6\u4e2d\u3002\u6839\u636e Electron \u7684\u5b98\u65b9\u6587\u6863\uff0c\u4f60\u9700\u8981\u9996\u5148\u5b89\u88c5 Node.js \u548c Electron\uff0c\u5e76\u521b\u5efa\u4e00\u4e2a\u65b0\u7684 Electron \u9879\u76ee\u3002<\/p>\n<p>\u5728\u8fd9\u4e2a\u65b0\u9879\u76ee\u6587\u4ef6\u5939\u91cc\uff0c\u521b\u5efa\u4e00\u4e2a\u4e3b\u8fdb\u7a0b\u6587\u4ef6\uff0c\u6bd4\u5982 `main.js`\uff0c\u91cc\u9762\u9700\u8981\u57fa\u672c\u914d\u7f6e\uff0c\u4f8b\u5982\u7a97\u53e3\u5927\u5c0f\u3001\u5165\u53e3\u9875\u9762\u5730\u5740\uff08\u53ef\u4ee5\u662f\u8fdc\u7a0bURL\uff0c\u4e5f\u53ef\u4ee5\u662f\u672c\u5730\u6587\u4ef6\u8def\u5f84\uff09\u7b49\u3002<\/p>\n<p>\u7136\u540e\uff0c\u5728 `package.json` \u6587\u4ef6\u4e2d\u6307\u5b9a\u5165\u53e3\u6587\u4ef6\uff0c\u914d\u7f6e\u9879\u76ee\u7684\u57fa\u672c\u4fe1\u606f\u3002<\/p>\n<p>\u6700\u540e\uff0c\u901a\u8fc7\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\u6765\u6253\u5305\u5e94\u7528\u7a0b\u5e8f\uff1a<\/p>\n<p>&#8220;`<\/p>\n<p>$ npm install<\/p>\n<p>$ npm start<\/p>\n<p>&#8220;`<\/p>\n<p>3. \u7f16\u8bd1\u548c\u6253\u5305\u5e94\u7528\u7a0b\u5e8f<\/p>\n<p>\u5b8c\u6210 Electron \u9879\u76ee\u7684\u914d\u7f6e\u540e\uff0c\u4f60\u9700\u8981\u4f7f\u7528\u5982 electron-packager\u3001electron-builder \u7b49\u5de5\u5177\u5c06\u5176\u7f16\u8bd1\u4e3a\u4e0d\u540c\u5e73\u53f0\u7684\u53ef\u6267\u884c\u6587\u4ef6\u3002\u6253\u5305\u5b8c\u6210\u540e\uff0c\u4f60\u53ef\u4ee5\u5728\u9879\u76ee\u6587\u4ef6\u5939\u4e2d\u627e\u5230\u5bf9\u5e94\u5e73\u53f0\u7684\u53ef\u6267\u884c\u6587\u4ef6\u3002\u8fd9\u6837\u4e00\u6765\uff0c\u4f60\u7684\u7f51\u9875\u5c31\u6210\u529f\u201c\u8f6c\u6362\u201d\u4e3a\u4e86\u4e00\u4e2a\u72ec\u7acb\u7684\u5ba2\u6237\u7aef\u5e94\u7528\u3002<\/p>\n<p>\u4e09\u3001\u603b\u7ed3<\/p>\n<p>\u5c06\u7f51\u9875\u6253\u5305\u6210\u5ba2\u6237\u7aef\u5e94\u7528\u80fd\u591f\u8ba9\u7528\u6237\u5728\u4e0d\u5b89\u88c5\u6d4f\u89c8\u5668\u7684\u60c5\u51b5\u4e0b\u8fdb\u884c\u4f53\u9a8c\uff0c\u540c\u65f6\uff0c\u4e5f\u6709\u52a9\u4e8e\u8fdb\u4e00\u6b65\u63d0\u5347\u4f60\u7684\u4ea7\u54c1\u5728\u5404\u4e2a\u5e73\u53f0\u4e0a\u7684\u63a8\u5e7f\u3002\u901a\u8fc7\u4f7f\u7528 WebView \u6280\u672f\u548c Electron \u6846\u67b6\uff0c\u4f60\u53ef\u4ee5\u5728\u7b80\u6d01\u7684\u5ba2\u6237\u7aef\u5e94\u7528\u4e2d\u5448\u73b0\u4e30\u5bcc\u7684\u7f51\u9875\u5185\u5bb9\u3002<\/p>\n<p>\u5f53\u7136\uff0c\u5c06\u7f51\u9875\u6253\u5305\u6210\u5ba2\u6237\u7aef\u5e94\u7528\u4e5f\u6709\u4e00\u5b9a\u7684\u5c40\u9650\u6027\uff0c\u5982\u6027\u80fd\u95ee\u9898\u3001\u8de8\u5e73\u53f0\u517c\u5bb9\u6027\u7b49\u3002\u7136\u800c\uff0c\u968f\u7740\u6280<a href=\"https:\/\/appfengzhuang.yimenapp.com\/app-162.html\">web\u7f51\u9875\u5c01\u88c5app<\/a>\u672f\u7684\u53d1\u5c55\uff0c\u8fd9\u4e9b\u95ee\u9898\u5728\u5f88\u5927\u7a0b\u5ea6\u4e0a\u5f97\u5230\u4e86\u7f13\u89e3\u3002\u901a\u8fc7\u672c\u6587\u7684\u4ecb\u7ecd\uff0c\u5e0c\u671b\u5bf9\u60f3\u8981\u5c06\u7f51\u9875\u8f6c\u6210\u5ba2\u6237\u7aef\u7684\u670b\u53cb\u6709\u6240\u5e2e\u52a9\u3002\u5728\u4ee5\u540e\u7684\u4e92\u8054\u7f51\u53d1\u5c55\u4e2d\uff0c\u8c01\u80fd\u8ddf\u4e0a\u65f6\u4ee3\u7684\u6b65\u4f10\uff0c\u8c01\u5c31\u662f\u80dc\u5229\u8005\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5728\u4e92\u8054\u7f51\u65e5\u76ca\u53d1\u5c55\u7684\u4eca\u5929\uff0c\u8d8a\u6765\u8d8a\u591a\u7684\u5e94\u7528\u8fc1\u79fb\u5230\u4e86\u4e91\u7aef\u3002\u684c\u9762\u5e94\u7528\u9010\u6e10\u88ab\u5185\u5d4c Web \u6d4f\u89c8\u5668\u7684\u8f7b\u91cf\u7ea7\u5ba2\u6237\u7aef\u53d6\u4ee3\uff0c\u8fd9\u4e3a\u8de8\u5e73\u53f0\u5f00\u53d1\u5e26\u6765\u4e86\u5f88\u5927\u7684\u4fbf\u5229\u3002\u5c06\u7f51\u9875\u6253\u5305\u6210\u5ba2\u6237\u7aef\u5e94\u7528\uff0c\u4f7f\u7528\u6237\u65e0\u9700\u6253\u5f00\u6d4f\u89c8\u5668\u5373\u53ef\u4eab\u53d7\u5230\u4e30\u5bcc\u591a<\/p>\n","protected":false},"author":24,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[13139,20490,74,75,135],"topic":[],"class_list":["post-20466","post","type-post","status-publish","format-standard","hentry","category-appkaifa","tag-phpapp","tag-app","tag-74","tag-75","tag-135"],"_links":{"self":[{"href":"https:\/\/www.yimenyun.ltd\/ezhan\/wp-json\/wp\/v2\/posts\/20466","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.yimenyun.ltd\/ezhan\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.yimenyun.ltd\/ezhan\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.yimenyun.ltd\/ezhan\/wp-json\/wp\/v2\/users\/24"}],"replies":[{"embeddable":true,"href":"https:\/\/www.yimenyun.ltd\/ezhan\/wp-json\/wp\/v2\/comments?post=20466"}],"version-history":[{"count":1,"href":"https:\/\/www.yimenyun.ltd\/ezhan\/wp-json\/wp\/v2\/posts\/20466\/revisions"}],"predecessor-version":[{"id":20496,"href":"https:\/\/www.yimenyun.ltd\/ezhan\/wp-json\/wp\/v2\/posts\/20466\/revisions\/20496"}],"wp:attachment":[{"href":"https:\/\/www.yimenyun.ltd\/ezhan\/wp-json\/wp\/v2\/media?parent=20466"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.yimenyun.ltd\/ezhan\/wp-json\/wp\/v2\/categories?post=20466"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.yimenyun.ltd\/ezhan\/wp-json\/wp\/v2\/tags?post=20466"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.yimenyun.ltd\/ezhan\/wp-json\/wp\/v2\/topic?post=20466"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}