{"id":1459,"date":"2023-07-31T18:40:22","date_gmt":"2023-07-31T10:40:22","guid":{"rendered":"https:\/\/www.yimenyun.cn\/emen\/?p=1459"},"modified":"2023-07-31T18:40:22","modified_gmt":"2023-07-31T10:40:22","slug":"html5%e7%94%9f%e6%88%90%e8%8b%b9%e6%9e%9c%e7%ab%afapp%e8%bd%af%e4%bb%b6%e6%93%8d%e4%bd%9c%e6%b5%81%e7%a8%8b%e4%bb%8b%e7%bb%8d","status":"publish","type":"post","link":"https:\/\/www.yimenyun.cn\/emen\/1459\/","title":{"rendered":"html5\u751f\u6210\u82f9\u679c\u7aefapp\u8f6f\u4ef6\u64cd\u4f5c\u6d41\u7a0b\u4ecb\u7ecd"},"content":{"rendered":"

\u5728\u672c\u7bc7\u6587\u7ae0\u4e2d\uff0c\u6211\u4eec\u5c06\u8be6\u7ec6\u4ecb\u7ecd\u5982\u4f55\u4f7f\u7528HTML5\u6280\u672f\u751f\u6210\u82f9\u679c\u7aefAPP\u8f6f\u4ef6\u3002\u8fd9\u4e3b\u8981\u901a\u8fc7\u5c06HTML5\u5e94\u7528\u7a0b\u5e8f\u6253\u5305\u4e3a\u539f\u751f\u7aefAPP\u7684\u65b9\u5f0f\u5b9e\u73b0\u3002\u73b0\u5728\u8ba9\u6211\u4eec\u6765\u4e00\u6b65\u4e00\u6b65\u5730\u6765\u4e86\u89e3\u6574\u4e2a\u8fc7\u7a0b\u3002<\/p>\n

1. HTML5\u7b80\u4ecb\uff1a<\/p>\n

HTML5\u662f\u4e00\u79cd\u65b0\u7684Web\u6807\u51c6\uff0c\u4ee5\u7b80\u5316Web\u5f00\u53d1\u8005\u7684\u5de5\u4f5c\u53ca\u63d0\u9ad8Web\u5f00\u53d1\u6548\u7387\u3002\u5b83\u63d0\u4f9b\u4e86\u5f88\u591a\u65b0\u7684\u5143\u7d20\u3001\u5c5e\u6027\u548cAPI\uff0c\u5982Canvas\u3001Video\u3001SVG\u3001WebGL\u3001WebRTC\u3001WebStorage\u7b49\u3002\u901a\u8fc7HTML5\uff0c\u5f00\u53d1\u8005\u53ef\u4ee5\u4f7f\u7528JavaScript\u3001CSS3\u7b49\u6280\u672f\u8f7b\u677e\u5730\u5f00\u53d1\u51fa\u529f\u80fd\u4e30\u5bcc\u3001\u8de8\u5e73\u53f0\u7684Web\u5e94\u7528\u7a0b\u5e8f\u3002<\/p>\n

2. \u539f\u7406\uff1a<\/p>\n

\u8981\u5c06HTML5\u751f\u6210\u82f9\u679c\u7aefAPP\u8f6f\u4ef6\uff0c\u6211\u4eec\u53ef\u4ee5\u501f\u52a9\u4e00\u4e9b\u5f00\u53d1\u5de5\u5177app\u56fe\u6807\u751f\u6210\u7f51\u7ad9<\/a>\u5982Apache Cordova\uff08PhoneGap\uff09\uff0c\u8fd9\u4e9b\u5de5\u5177\u53ef\u4ee5\u8ba9\u4f60\u4ee5WebView\u7684\u5f62\u5f0f\u5d4c\u5165HTML5\u4ee3\u7801\u5230\u539f\u751f\u5e94\u7528\u4e2d\u3002\u5b9e\u9645\u4e0a\uff0cHTML5\u5e94\u7528\u7a0b\u5e8f\u5728\u539f\u751fAPP\u7684\u5bb9\u5668\u4e2d\u8fd0\u884c\uff0c\u901a\u8fc7\u539f\u751fAPI\u548c\u8bbe\u5907\u7684\u786c\u4ef6\u8fdb\u884c\u4ea4\u4e92\u3002\u8fd9\u6837\uff0c\u4f60\u5c31\u53ef\u4ee5\u4f7f\u7528HTML5\u6280\u672f\u5f00\u53d1\u5177\u6709\u8bbf\u95ee\u8bbe\u5907\u529f\u80fd\u7684\u82f9\u679c\u7aefAPP\u8f6f\u4ef6\u3002<\/p>\n

3.\u8be6\u7ec6\u6b65\u9aa4\uff1a<\/p>\n

\u6b65\u9aa41\uff1a\u51c6\u5907HTML5\u5185\u5bb9<\/p>\n

\u9996\u5148\uff0c\u4f60\u9700\u8981\u521b\u5efa\u4e00\u4e2aHTML5\u5e94\u7528\u7a0b\u5e8f\u3002\u8bf7\u786e\u4fdd\u4f7f\u7528\u54cd\u5e94\u5f0f\u5e03\u5c40\u3001\u6b63\u786e\u7684Meta\u6807\u7b7e\u4ee5\u53ca\u9700\u8981\u4f7f\u7528\u7684JavaScript\u5e93\uff0c\u5982jQuery\u3001Angular\u7b49\u3002<\/p>\n

\u6b65\u9aa4\u7f51\u9875\u4e00\u952e\u751f\u6210app\u8f6f\u4ef6\u4e0b\u8f7d<\/a>2\uff1a\u5b89\u88c5Apache Cordova<\/p>\n

\u5b89\u88c5Node.js\uff0c\u5e76\u4f7f\u7528npm\u5b89\u88c5Apache Cordova\u3002<\/p>\n

“`<\/p>\n

npm install -g cordova<\/p>\n

“`<\/p>\n

\u6b65\u9aa43\uff1a\u521b\u5efaCordova\u9879\u76ee<\/p>\n

\u5728\u7ec8\u7aef\u6216\u547d\u4ee4\u884c\u4e2d\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4<\/p>\n

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

\u6765\u521b\u5efa\u4e00\u4e2a\u65b0\u7684Cordova\u9879\u76ee\u3002<\/p>\n

“`<\/p>\n

cordova create myApp com.example.myApp myApp<\/p>\n

“`<\/p>\n

\u5176\u4e2d\uff0cmyApp\u662f\u4f60\u7684APP\u540d\u79f0\uff0ccom.example.myApp\u4e3a\u9006\u5411\u57df\u540d\uff0c\u7528\u4e8e\u552f\u4e00\u6807\u8bc6APP\u3002<\/p>\n

\u6b65\u9aa44\uff1a\u52a0\u5165iOS\u5e73\u53f0<\/p>\n

\u8fdb\u5165\u521a\u521a\u521b\u5efa\u7684Cordova\u9879\u76ee\u76ee\u5f55\uff0c\u7136\u540e\u6dfb\u52a0iOS\u5e73\u53f0\u3002<\/p>\n

“`<\/p>\n

cd myApp<\/p>\n

cordova platform add ios<\/p>\n

“`<\/p>\n

\u6b65\u9aa45\uff1a\u590d\u5236HTML5\u6587\u4ef6<\/p>\n

\u5c06\u4f60\u7684HTML5\u5e94\u7528\u7a0b\u5e8f\u7684\u6240\u6709\u6587\u4ef6\u590d\u5236\u5230Cordova\u9879\u76ee\u7684www\u76ee\u5f55\u4e2d\u3002<\/p>\n

\u6b65\u9aa46\uff1a install \u63d2\u4ef6<\/p>\n

\u4f60\u53ef\u80fd\u9700\u8981\u8bbf\u95ee\u8bbe\u5907\u7684\u4e00\u4e9b\u529f\u80fd\uff0c\u6bd4\u5982\u76f8\u673a\u3001GPS\u7b49\u3002\u4e3a\u6b64\uff0c\u8bf7\u5b89\u88c5\u76f8\u5e94\u7684Cordova\u63d2\u4ef6\u3002\u4f8b\u5982\uff1a<\/p>\n

“`<\/p>\n

cordova plugin add cordova-plugin-camera<\/p>\n

“`<\/p>\n

\u6b65\u9aa47\uff1a \u7f16\u5199\u4ee3\u7801<\/p>\n

\u5728Cordova\u9879\u76ee\u7684www\u76ee\u5f55\u4e2d\u7684JavaScript\u6587\u4ef6\u4e2d\uff0c\u4f7f\u7528Cordova API\u8c03\u7528\u76f8\u5e94\u7684\u8bbe\u5907\u529f\u80fd\u3002<\/p>\n

\u6b65\u9aa48\uff1a \u7f16\u8bd1\u548c\u8fd0\u884c<\/p>\n

\u5728Cordova\u9879\u76ee\u76ee\u5f55\u4e2d\uff0c\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\u4ee5\u7f16\u8bd1\u5e76\u8fd0\u884c\u4f60\u7684\u5e94\u7528\u7a0b\u5e8f\u3002<\/p>\n

“`<\/p>\n

cordova build ios<\/p>\n

cordova run ios<\/p>\n

“`<\/p>\n

\u8fd0\u884c\u8fd9\u4e9b\u547d\u4ee4\u540e\uff0cCordova\u5c06\u7f16\u8bd1\u5e76\u5728iOS\u6a21\u62df\u5668\u4e0a\u8fd0\u884c\u4f60\u7684\u5e94\u7528\u3002\u5982\u679c\u4f60\u5e0c\u671b\u5728\u5b9e\u9645\u8bbe\u5907\u4e0a\u8fdb\u884c\u6d4b\u8bd5\uff0c\u53ef\u4ee5\u8fde\u63a5\u4f60\u7684iOS\u8bbe\u5907\uff0c\u5e76\u4f7f\u7528Xcode\u5c06\u7f16\u8bd1\u597d\u7684APP\u5b89\u88c5\u5230\u8bbe\u5907\u4e0a\u3002<\/p>\n

\u4ee5\u4e0a\u5c31\u662f\u5229\u7528HTML5\u751f\u6210\u82f9\u679c\u7aefAPP\u8f6f\u4ef6\u7684\u8be6\u7ec6\u6559\u7a0b\u3002\u5e0c\u671b\u5bf9\u4f60\u6709\u6240\u5e2e\u52a9\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"

\u5728\u672c\u7bc7\u6587\u7ae0\u4e2d\uff0c\u6211\u4eec\u5c06\u8be6\u7ec6\u4ecb\u7ecd\u5982\u4f55\u4f7f\u7528HTML5\u6280\u672f\u751f\u6210\u82f9\u679c\u7aefAPP\u8f6f\u4ef6\u3002\u8fd9\u4e3b\u8981\u901a\u8fc7\u5c06HTML5\u5e94\u7528\u7a0b\u5e8f\u6253\u5305\u4e3a\u539f\u751f\u7aefAPP\u7684\u65b9\u5f0f\u5b9e\u73b0\u3002\u73b0\u5728\u8ba9\u6211\u4eec\u6765\u4e00\u6b65\u4e00\u6b65\u5730\u6765\u4e86\u89e3\u6574\u4e2a\u8fc7\u7a0b\u30021. HTML5\u7b80\u4ecb\uff1aHTM<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[12,3212,3211,797,56],"topic":[],"class_list":{"0":"post-1459","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"hentry","6":"category-appkf","7":"tag-12","8":"tag-app","10":"tag-797","11":"tag-56"},"_links":{"self":[{"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/posts\/1459","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\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/comments?post=1459"}],"version-history":[{"count":0,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/posts\/1459\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/media?parent=1459"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/categories?post=1459"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/tags?post=1459"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/topic?post=1459"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}