{"id":1463,"date":"2023-07-31T18:40:18","date_gmt":"2023-07-31T10:40:18","guid":{"rendered":"https:\/\/www.yimenyun.cn\/emen\/?p=1463"},"modified":"2023-07-31T18:40:18","modified_gmt":"2023-07-31T10:40:18","slug":"app-h5%e6%89%93%e5%8c%85%e7%94%9f%e6%88%90%e5%8a%9f%e8%83%bd%e4%bb%8b%e7%bb%8d","status":"publish","type":"post","link":"https:\/\/www.yimenyun.cn\/emen\/1463\/","title":{"rendered":"app h5\u6253\u5305\u751f\u6210\u529f\u80fd\u4ecb\u7ecd"},"content":{"rendered":"

H5 App\u6253\u5305\u751f\u6210\u662f\u4e00\u79cd\u5c06\u524d\u7aefH5\u5e94\u7528\u8f6c\u6362\u6210\u53ef\u4ee5\u5728\u79fb\u52a8\u8bbe\u5907\u4e0a\u8fd0\u884c\u7684\u539f\u751f\u5e94\u7528\u7684\u65b9\u5f0f\u3002\u539f\u7406\u662f\u901a\u8fc7\u5c06H5\u5e94\u7528\u5d4c\u5165\u5230\u4e00\u4e2a\u539f\u751fApp\u7684Web\u5bb9\u5668\u4e2d\uff0cWeb\u5bb9\u5668\u662f\u4e00\u4e2a\u539f\u751f\u5f00\u53d1\u7684\u666e\u901a\u5e94\u7528\uff0c\u5185\u90e8\u5305\u542b\u54ea\u4e2a\u4e00\u952e\u751f\u6210app\u7f51\u7ad9\u7ed9\u6e90\u7801<\/a>\u4e00\u4e2aWebView\u7ec4\u4ef6\uff0cWebView\u7ec4\u4ef6\u53ef\u4ee5\u52a0\u8f7d\u548c\u6e32\u67d3H5\u5e94\u7528\u9875\u9762\u3002\u901a\u8fc7\u8fd9\u79cd\u65b9\u5f0f\uff0c\u4f60\u53ef\u4ee5\u628a\u4e00\u4e2aH5\u5e94\u7528\u5c01\u88c5\u6210\u4e00\u4e2a\u539f\u751f\u79fb\u52a8\u5e94\u7528\uff0c\u65e0\u9700\u4e3a\u6bcf\u4e2a\u79fb\u52a8\u5e73\u53f0\uff08Android\u548ciOS\uff09\u5206\u522b\u5f00\u53d1\u539f\u751f\u5e94\u7528\u3002<\/p>\n

\u4e0b\u9762\u6211\u4eec\u8be6\u7ec6\u4ecb\u7ecdH5\u6253\u5305\u751f\u6210\u7684\u8fc7\u7a0b\uff1a<\/p>\n

1. \u51c6\u5907H5\u5e94\u7528\uff1a<\/p>\n

\u9996\u5148\uff0c\u4f60\u9700\u8981\u6709\u4e00\u4e2a\u5b8c\u6210\u7684H5\u5e94\u7528\uff0c\u5305\u62ecHTML\u3001CSS\u3001JavaScript\u7b49\u8d44\u6e90\u6587\u4ef6\u3002\u4f60\u53ef\u4ee5\u901a\u8fc7\u524d\u7aef\u5f00\u53d1\u6280\u672f\uff08\u5982HTML5\u3001CSS3\u3001JavaScript\u3001jQuery\u7b49\uff09\u6765\u5f00\u53d1\u8fd9\u4e2a\u5e94\u7528\u3002<\/p>\n

2. \u9009\u62e9\u6253\u5305\u5de5\u5177\uff1a<\/p>\n

\u6709\u5f88\u591aH5\u5e94\u7528\u6253\u5305\u5de5\u5177\u53ef\u4f9b\u9009\u62e9\uff0c\u8fd9\u91cc\u6211\u4eec\u4ee5Apache Cordova\uff08\u4e00\u6b3e\u975e\u5e38\u8457\u540d\u7684H5\u6253\u5305\u5de5\u5177\uff09\u4e3a\u4f8b\u3002\u5176\u5b83\u7c7b\u4f3c\u7684\u5de5\u5177\u8fd8\u6709Ionic\u3001React Native\u3001Flutter\u7b49\u3002\u4f60\u53ef\u4ee5\u6839\u636e\u5b9e\u9645\u9700\u6c42\u9009\u62e9\u76f8\u5e94\u7684\u5de5\u5177\u3002<\/p>\n

3. \u5b89\u88c5Apache Cordova\uff1a<\/p>\n

\u9996\u5148\uff0c\u5728\u547d\u4ee4\u884c\u4e2d\u901a\u8fc7npm\u5b89\u88c5Cordova\uff1a`npm install -g cordova`\u3002<\/p>\n

4. \u5f00\u59cb\u6253\u5305\uff1a<\/p>\n

(1) \u521b\u5efacordova\u9879\u76ee\uff1a`cordova create myApp [your_package_id] MyAppName`\u3002<\/p>\n

(2) \u8fdb\u5165\u9879\u76ee\u76ee\u5f55\uff1a`cd myApp`\u3002<\/p>\n

(3) \u6dfb\u52a0\u79fb\u52a8\u5e73\u53f0\uff1a`cordova platform\u4e00\u4e2a\u7f51\u7ad9\u751f\u6210app<\/a> add android`\uff08\u6216`cordova platform add ios`\uff09\u3002<\/p>\n

(4) \u628a\u4f60\u7684H5\u5e94\u7528\u8d44\u6e90\u6587\u4ef6\uff08\u5982index.html\u3001CSS\u3001JavaScript\u7b49\uff09\u66ff\u6362\u5230 \/www \u76ee\u5f55\u4e0b\u3002<\/p>\n

(5) \u6dfb\u52a0\u9700\u8981\u7684cordova\u63d2\u4ef6\uff08\u5982Camera\u3001Contacts\u7b49\uff09\u3002\u4f8b\u5982\uff1a`cordova plugin add cordova-plugin-camera`\u3002<\/p>\n

(6) \u7f16\u8bd1\u6253\u5305\u5e94\u7528\uff1a`cordova build android`\uff08\u6216`cordova build ios`\uff09\u3002<\/p>\n

5. \u5b8c\u6210\u6253\u5305\uff1a <\/p>\n

\u5728\u5b8c\u6210\u8fd9\u4e9b\u6b65\u9aa4\u540e\uff0c\u4f60\u7684H5\u5e94\u7528\u5c31\u5df2\u7ecf\u88ab\u6210\u529f\u5c01\u88c5\u6210\u4e00\u4e2a\u539f\u751f\u79fb\u52a8\u5e94\u7528\u4e86\u3002\u5728 platforms\/android\/app\/build\/ou<\/p>\n

<\/figure>\n<\/p>\n

tputs\/apk \u6216 platforms\/ios\/build\/ \u76ee\u5f55\u4e0b\u53ef\u4ee5\u627e\u5230\u751f\u6210\u7684.apk\uff08\u5b89\u5353\uff09\u6216.ipa\uff08iOS\uff09\u6587\u4ef6\u3002<\/p>\n

\u6ce8\u610f\uff1a<\/p>\n

1) \u6839\u636e\u6253\u5305\u7684\u5e73\u53f0\u4e0d\u540c\uff0cAndroid\u548ciOS\u53ef\u80fd\u9700\u8981\u4e0d\u540c\u7684\u64cd\u4f5c\u3002\u4f8b\u5982\uff0c\u4e3aiOS\u6253\u5305\u65f6\uff0c\u8fd8\u9700\u8981\u5b89\u88c5Xcode\u3001\u914d\u7f6e\u7b7e\u540d\u7b49\u3002\u5177\u4f53\u7684\u64cd\u4f5c\u4f60\u53ef\u4ee5\u53c2\u7167Cordova\u5b98\u65b9\u6587\u6863\u3002<\/p>\n

2) H5\u6253\u5305\u7684\u65b9\u5f0f\u6709\u4f18\u70b9\u4e5f\u6709\u7f3a\u70b9\u3002\u4f18\u70b9\u662f\u5f00\u53d1\u6210\u672c\u4f4e\u3001\u6548\u7387\u9ad8\uff0c\u7f3a\u70b9\u662f\u6027\u80fd\u53ef\u80fd\u4e0d\u5982\u539f\u751f\u5e94\u7528\u5e76\u4e14\u67d0\u4e9b\u8bbe\u5907\u529f\u80fd\u4e0a\u53ef\u80fd\u5b58\u5728\u9650\u5236\u3002<\/p>\n

3) \u5982\u679c\u4f60\u7684\u5e94\u7528\u9700\u8981\u5728\u5404\u4e2a\u5e73\u53f0\u4e0a\u83b7\u5f97\u66f4\u4f18\u7684\u6027\u80fd\u8868\u73b0\uff0c\u53ef\u4ee5\u8003\u8651\u4f7f\u7528React Native\u7b49\u3002\u8fd9\u4e9b\u5de5\u5177\u63d0\u4f9b\u4e86\u4e00\u4e2a\u5728\u539f\u751f\u5c42\u8fdb\u884c\u6e32\u67d3\u7684JS Bridge\uff0c\u53ef\u4ee5\u5c06JS\u4ee3\u7801\u8f6c\u6362\u6210\u771f\u6b63\u7684\u539f\u751fUI\u7ec4\u4ef6\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"

H5 App\u6253\u5305\u751f\u6210\u662f\u4e00\u79cd\u5c06\u524d\u7aefH5\u5e94\u7528\u8f6c\u6362\u6210\u53ef\u4ee5\u5728\u79fb\u52a8\u8bbe\u5907\u4e0a\u8fd0\u884c\u7684\u539f\u751f\u5e94\u7528\u7684\u65b9\u5f0f\u3002\u539f\u7406\u662f\u901a\u8fc7\u5c06H5\u5e94\u7528\u5d4c\u5165\u5230\u4e00\u4e2a\u539f\u751fApp\u7684Web\u5bb9\u5668\u4e2d\uff0cWeb\u5bb9\u5668\u662f\u4e00\u4e2a\u539f\u751f\u5f00\u53d1\u7684\u666e\u901a\u5e94\u7528\uff0c\u5185\u90e8\u5305\u542b\u4e00\u4e2aWebVi<\/p>\n","protected":false},"author":6,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[3221,27,52,736,3220],"topic":[],"class_list":["post-1463","post","type-post","status-publish","format-standard","hentry","category-appkf","tag-wapapp","tag-27","tag-52","tag-736","tag-app"],"_links":{"self":[{"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/posts\/1463","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/comments?post=1463"}],"version-history":[{"count":0,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/posts\/1463\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/media?parent=1463"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/categories?post=1463"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/tags?post=1463"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/topic?post=1463"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}