{"id":5202,"date":"2023-08-03T11:36:43","date_gmt":"2023-08-03T03:36:43","guid":{"rendered":"https:\/\/www.zhidianwl.com\/zhidian\/?p=5202"},"modified":"2023-08-03T11:36:43","modified_gmt":"2023-08-03T03:36:43","slug":"%e6%80%8e%e4%b9%88%e5%b0%81%e8%a3%85h5%e7%9a%84app","status":"publish","type":"post","link":"https:\/\/www.zhidianwl.com\/zhidian\/2023\/5202\/","title":{"rendered":"\u600e\u4e48\u5c01\u88c5h5\u7684app?"},"content":{"rendered":"

\u5c01\u88c5 H5 \u5e94\u7528\u5230 APP \u4e0a\u9762\u4e3b\u8981\u5206\u4e3a\u4e09\u79cd\u65b9\u5f0f\uff0c\u5206\u522b\u662f WebView \u5c01\u88c5\u3001Hybrid \u6846\u67b6\u5c01\u88c5\u548c React Native \u5c01\u88c5\u3002<\/p>\n

1. WebView \u5c01\u88c5<\/p>\n

WebView \u662f Android \u548c iOS \u7cfb\u7edf\u81ea\u5e26\u7684\u63a7\u4ef6\uff0c\u53ef\u4ee5\u52a0\u8f7d\u7f51\u9875\uff0c\u6211\u4eec\u53ef\u4ee5\u5229\u7528 WebView \u63a7\u4ef6\u6765\u5c01\u88c5 H5 \u5e94\u7528\uff0c\u540c\u65f6 WebView \u4e5f\u53ef\u4ee5\u8c03\u7528 JS \u7684\u65b9\u6cd5\uff0c\u5c06 WebView \u4e0a\u9762\u7684 H5 \u4e0e\u539f\u751f APP \u7684\u4ea4\u4e92\u5b9e\u73b0\u3002<\/p>\n

\u5c01\u88c5\u7684\u5177\u4f53\u6d41\u7a0b\uff1a<\/p>\n

\u2460 \u6839\u636e\u8bbe\u8ba1\u7a3f\u6a21\u677f\u8c03\u6574 WebView \u5168\u5c4f\u98ce\u683c\u548c\u6a2a\u5c4f\u7ad6\u5c4f\u652f\u6301\u3002<\/p>\n

\u2461 \u901a\u8fc7 WebView \u5fc5\u8981\u7684\u914d\u7f6e\uff0c\u5982\u8bbe\u7f6e WebViewClient\uff0c\u7981\u7528\u7f13\u5b58\uff0c\u5141\u8bb8 JavaScript \u8c03\u7528\u81ea\u5e26 API\uff0c\u5982\u83b7\u53d6\u624b\u673a\u7cfb\u7edf\u4fe1\u606f\u7b49\u3002<\/p>\n

\u2462 \u901a\u8fc7 JSBridge \u901a\u4fe1\u534f\u8bae\u5b9e\u73b0 H5 \u9875\u9762\u4e0e\u539f\u751f\u9875\u9762\u7684\u4ea4\u4e92\u3002<\/p>\n

\u4f18\u70b9\uff1a<\/p>\n

a. \u5f00\u53d1\u96be\u5ea6\u4f4e\uff0c\u4e0d\u9700\u8981\u592a\u591a\u7684\u539f\u751f\u5f00\u53d1\u7ecf\u9a8c\u3002<\/p>\n

b. \u5c01\u88c5\u7684\u5e94\u7528\u4e0d\u9700\u8981\u8fdb\u884c APP \u5ba1\u6838\uff0c\u5feb\u901f\u4e0a\u7ebf\u3002<\/p>\n

\u7f3a\u70b9\uff1a<\/p>\n

a. \u5e94\u7528\u8bbf\u95ee\u901f\u5ea6\u8f83\u6162\uff0c\u4f1a\u9020\u6210\u7528\u6237\u4f7f\u7528\u4f53\u9a8c\u4e0d\u597d\u3002<\/p>\n

b. WebVi\u6cb3\u6e90h5\u5f00\u53d1app<\/a>ew \u4e00\u4e9b\u6027\u80fd\u74f6\u9888\uff0c\u5982\u52a0\u8f7d\u591a\u4e2a\u8d44\u6e90\u65f6\u4f1a\u9020\u6210\u9875\u9762\u5361\u987f\u6216\u767d\u5c4f\u3002<\/p>\n

2. Hybrid \u6846\u67b6\u5c01\u88c5<\/p>\n

Hybrid \u6846\u67b6\u7ed3\u5408\u4e86 WebView \u548c\u539f\u751f\u5f00\u53d1\u7684\u4f18\u70b9\uff0c\u5728\u539f\u751f\u5e94\u7528\u6846\u67b6\u4e2d\u5185\u5d4c Web \u5bb9\u5668\uff0c\u540c\u65f6\u4e5f\u53ef\u4ee5\u8c03\u7528\u539f\u751f API\uff0c\u5b9e\u73b0 Web \u4e0e\u539f\u751f\u4ee3\u7801\u7684\u4ea4\u4e92\u3002Hybrid \u5e94\u7528\u7684\u4e3b\u8981\u6280\u672f\u5305\u542b Cordova\u3001Ionic\u3001PhoneGap\u3001Kendo UI \u7b49\u3002<\/p>\n

\u5c01\u88c5\u7684\u5177\u4f53\u6d41\u7a0b\uff1a<\/p>\n

a. \u6839\u636e UI \u98ce\u683c\u8bbe\u8ba1\u5ba2\u6237\u7aef\u3002<\/p>\n

b. \u914d\u7f6e WebView\uff0c\u5b9e\u73b0 WebView \u548c\u539f\u751f API \u7684\u4ea4\u4e92\u3002<\/p>\n

c. H5 \u754c\u9762\u5e03\u5c40\uff0c\u7ec4\u7ec7\u6570\u636e\u548c\u6837\u5f0f\u8868\u3002<\/p>\n

d. \u6d4b\u8bd5\u548c\u8c03\u8bd5\u3002<\/p>\n

\u4f18\u70b9\uff1a<\/p>\n

a. \u5f00\u53d1\u6548\u7387\u9ad8\uff0c\u8de8\u5e73\u53f0\u5f00\u53d1\u4fbf\u6377\u3002<\/p>\n

b. Hybrid \u6846\u67b6\u53ef\u4ee5\u72ec\u7acb\u7ba1\u7406\u7f51\u9875\u5185\u5bb9\uff0c\u5bf9\u5f00\u53d1\u8005\u548c\u7f51\u7ad9\u7ef4\u62a4\u8005\u90fd\u6709\u5f88\u5927\u7684\u4fbf\u5229\u6027\u3002<\/p>\n

\u7f3a\u70b9\uff1a<\/p>\n

a. \u5ba2\u6237\u7aef\u4f53\u79ef\u8f83\u5927\uff0c\u542f\u52a8\u901f\u5ea6\u8f83\u6162\u3002<\/p>\n

b. \u9879\u76ee\u80cc\u666f\u4e0d\u540c\uff0c\u9700\u8981\u9488\u5bf9\u6027\u8fdb\u884c\u5f00\u53d1\u3002<\/p>\n

3. React Native \u5c01\u88c5<\/p>\n

React Native \u662f Facebook \u63a8\u51fa\u7684\u4e00\u6b3e\u8de8\u5e73\u53f0\u6280\u672f\uff0c\u57fa\u4e8e JavaScript \u5e93 React\uff0c\u6865\u63a5\u4e86\u539f\u751f\u548c JavaScript \u4e4b\u95f4\u7684\u5dee\u5f02\uff0c\u4f7f\u5f97 React Native \u5e94\u7528\u53ef\u4ee5\u76f4\u63a5\u8c03\u7528\u539f\u751f API\uff0c\u5e76\u5728\u539f\u751f\u73af\u5883\u4e0b\u8fd0\u884c\u3002<\/p>\n

\u5c01\u88c5<\/p>\n

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

\u7684\u5177\u4f53\u6d41\u7a0b\uff1a<\/p>\n

a. \u5b89\u88c5 React Native \u76f8\u5173\u4f9d\u8d56\u3002<\/p>\n

b. \u5728 Reaandroid app h5\u5f00\u53d1<\/a>ct Native \u5f00\u53d1\u73af\u5883\u4e2d\u7f16\u5199\u5e94\u7528\u7a0b\u5e8f\u3002<\/p>\n

c. \u5f15\u5165 React Native \u6269\u5c55\u7ec4\u4ef6\u3002<\/p>\n

d. \u5c06\u5e94\u7528\u7a0b\u5e8f\u6253\u5305\uff0c\u751f\u6210 Native \u4ee3\u7801\u3002<\/p>\n

\u4f18\u70b9<\/p>\n","protected":false},"excerpt":{"rendered":"

\u5c01\u88c5 H5 \u5e94\u7528\u5230 APP \u4e0a\u9762\u4e3b\u8981\u5206\u4e3a\u4e09\u79cd\u65b9\u5f0f\uff0c\u5206\u522b\u662f WebView \u5c01\u88c5\u3001Hybrid \u6846\u67b6\u5c01\u88c5\u548c React Native \u5c01\u88c5\u30021. WebView \u5c01\u88c5WebView \u662f Android<\/p>\n","protected":false},"author":15,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[9882,9880,1216,9881,74],"class_list":{"0":"post-5202","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"hentry","6":"category-zuoapp","7":"tag-h5app","9":"tag-1216","10":"tag-9881","11":"tag-74"},"_links":{"self":[{"href":"https:\/\/www.zhidianwl.com\/zhidian\/wp-json\/wp\/v2\/posts\/5202","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\/15"}],"replies":[{"embeddable":true,"href":"https:\/\/www.zhidianwl.com\/zhidian\/wp-json\/wp\/v2\/comments?post=5202"}],"version-history":[{"count":0,"href":"https:\/\/www.zhidianwl.com\/zhidian\/wp-json\/wp\/v2\/posts\/5202\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.zhidianwl.com\/zhidian\/wp-json\/wp\/v2\/media?parent=5202"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.zhidianwl.com\/zhidian\/wp-json\/wp\/v2\/categories?post=5202"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.zhidianwl.com\/zhidian\/wp-json\/wp\/v2\/tags?post=5202"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}