html \u8f6c\u5c0f\u7a0b\u5e8f<\/a>a \u5c5e\u6027\u6765\u4f20\u9012\u3002<\/p>\n3. \u8bbe\u7f6e H5 \u7f51\u9875\u7684 URL \u5730\u5740<\/p>\n
\u5728\u5c0f\u7a0b\u5e8f\u7684 JS \u6587\u4ef6\u4e2d\uff0c\u6211\u4eec\u9700\u8981\u5b9a\u4e49 H5 \u7f51\u9875\u7684 URL \u5730\u5740\uff0c\u5e76\u5c06\u5176\u4f20\u9012\u7ed9 web-view \u7ec4\u4ef6\u3002\u53ef\u4ee5\u901a\u8fc7\u5c0f\u7a0b\u5e8f\u7684 onLoad \u65b9\u6cd5\u6765\u83b7\u53d6\u4f20\u9012\u8fc7\u6765\u7684 URL \u5730\u5740\uff0c\u5e76\u5c06\u5176\u8bbe\u7f6e\u4e3a web-view \u7ec4\u4ef6\u7684 src \u5c5e\u6027\u3002\u4ee3\u7801\u5982\u4e0b\uff1a<\/p>\n
“`<\/p>\n
Page({<\/p>\n
onLoad: function(options) {<\/p>\n
this.setData({<\/p>\n
url: options.url<\/p>\n
});<\/p>\n
}<\/p>\n
});<\/p>\n
“`<\/p>\n
4. \u5c06 H5 \u7f51\u9875\u5d4c\u5165\u5230\u5c0f\u7a0b\u5e8f\u4e2d<\/p>\n
\u6700\u540e\uff0c\u6211\u4eec\u9700\u8981\u5728\u5c0f\u7a0b\u5e8f\u4e2d\u4f7f\u7528\u9875\u9762\u8df3\u8f6c\u529f\u80fd\uff0c\u5c06\u65b0\u5efa\u7684\u9875\u9762\u8df3\u8f6c\u5230\u6211\u4eec\u521a\u624d\u521b\u5efa\u7684\u9875\u9762\u4e2d\u3002\u5728\u5c0f\u7a0b\u5e8f\u7684 JS \u6587\u4ef6\u4e2d\uff0c\u4f7f\u7528\u5c0f\u7a0b\u5e8f\u7684 navigateTo \u65b9\u6cd5\u6765\u8df3\u8f6c\u5230\u65b0\u5efa\u7684\u9875\u9762\u3002\u4ee3\u7801\u5982\u4e0b\uff1a<\/p>\n
“`<\/p>\n
wx.navigateTo({<\/p>\n
url: ‘\/pages\/webview\/webview?url=’ + encodeURIComponent(url)<\/p>\n
})<\/p>\n
“`<\/p>\n
\u5176\u4e2d\uff0c\/pages\/webview\/webview \u662f\u65b0\u5efa\u7684\u9875\u9762\u7684\u8def\u5f84\uff0curl \u662f H5 \u7f51\u9875\u7684 URL \u5730\u5740\u3002<\/p>\n
\u4e09\u3001\u6ce8\u610f\u4e8b\u9879<\/p>\n
1. H5 \u7f51\u9875\u5fc5\u987b\u652f\u6301 HTTPS \u534f\u8bae\uff0c\u5426\u5219\u65e0\u6cd5\u5728\u5c0f\u7a0b\u5e8f\u4e2d\u52a0\u8f7d\u3002<\/p>\n
2. H5 \u7f51\u9875\u4e2d\u4e0d\u80fd\u4f7f\u7528\u5fae\u4fe1\u7684 JS-SDK\uff0c\u56e0\u4e3a\u5c0f\u7a0b\u5e8f\u4e2d\u6ca1\u6709 wx \u5bf9\u8c61\u3002<\/p>\n
3. H5 \u7f51\u9875\u4e2d\u7684\u4e00\u4e9b\u529f\u80fd\uff08\u5982\u5206\u4eab\u3001\u652f\u4ed8\u7b49\uff09\u53ef\u80fd\u65e0\u6cd5\u5728\u5c0f\u7a0b\u5e8f\u4e2d\u6b63\u5e38\u4f7f\u7528\uff0c\u9700\u8981\u8fdb\u884c\u9002\u5f53\u7684\u8c03\u6574\u3002<\/p>\n
\u603b\u7ed3<\/p>\n
\u901a\u8fc7\u4ee5\u4e0a\u6b65\u9aa4\uff0c\u6211\u4eec\u53ef\u4ee5\u5728\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u4e2d\u5d4c\u5165 H5 \u7f51\u9875\uff0c\u4e3a\u5c0f\u7a0b\u5e8f\u63d0\u4f9b\u66f4\u591a\u7684\u529f\u80fd\u548c\u670d\u52a1\u3002\u5f53\u7136\uff0c\u5728\u5b9e\u9645\u5e94\u7528\u4e2d\uff0c\u6211\u4eec\u8fd8\u9700\u8981\u8003\u8651\u4e00\u4e9b\u5176\u4ed6\u7684\u95ee\u9898\uff0c\u5982 H5 \u7f51\u9875\u7684\u9002\u914d\u548c\u6027\u80fd\u4f18\u5316\u7b49\u3002\u5e0c\u671b\u672c\u6587\u5bf9\u5927\u5bb6\u6709\u6240\u5e2e\u52a9\u3002<\/p>\n
\u4e00\u95e8\u5c0f\u7a0b\u5e8f\u5f00\u53d1\u5de5\u5177\uff08https:\/\/sapp.yimenapp.com\/\uff09\u662f\u4e00\u6b3e\u4e91\u7aef\u5316\u8de8\u5e73\u53f0\u5f00\u53d1\u5de5\u5177\uff0c\u53ef\u4ee5\u4e00\u952e\u5728\u7ebf\u5c06\u7f51\u7ad9\u6253\u5305\u6210\u5c0f\u7a0b\u5e8f\uff0c\u652f\u6301\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u3001\u652f\u4ed8\u5b9d\u5c0f\u7a0b\u5e8f\u3001\u6296\u97f3\u5c0f\u7a0b\u5e8f\u3001\u5feb\u624b\u5c0f\u7a0b\u5e8f\u3001\u767e\u5ea6\u5c0f\u7a0b\u5e8f\u7b49\u56fd\u5185\u4e3b\u6d41\u5c0f\u7a0b\u5e8f\u5e73\u53f0\u3002\u4e00\u95e8\u63d0\u4f9b100+\u5c0f\u7a0b\u5e8f\u539f\u751f\u63a5\u53e3\u81ea\u52a9\u8c03\u7528\uff0c\u5f00\u53d1\u8005\u53ea\u9700\u8981\u4f7f\u7528\u5f00\u53d1\u7f51\u7ad9\u7684\u80fd\u529b\u5373\u53ef\u5728\u7ebf\u5feb\u901f\u5236\u4f5c\u5c0f\u7a0b\u5e8f\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"
\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u662f\u4e00\u79cd\u8f7b\u91cf\u7ea7\u7684\u5e94\u7528\u7a0b\u5e8f\uff0c\u53ef\u4ee5\u5728\u5fae\u4fe1\u4e2d\u76f4\u63a5\u8fd0\u884c\uff0c\u65e0\u9700\u4e0b\u8f7d\u5b89\u88c5\u3002\u867d\u7136\u5c0f\u7a0b\u5e8f\u5177\u6709\u5f88\u591a\u7684\u529f\u80fd\uff0c\u4f46\u662f\u6709\u65f6\u5019\u6211\u4eec\u9700\u8981\u5728\u5c0f\u7a0b\u5e8f\u4e2d\u5d4c\u5165\u4e00\u4e9b H5 \u7f51\u9875\uff0c\u4ee5\u63d0\u4f9b\u66f4\u591a\u7684\u529f\u80fd\u548c\u670d\u52a1\u3002\u672c\u6587\u5c06\u4ecb\u7ecd\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u5d4c\u5165 H<\/p>\n","protected":false},"author":25,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[23326,398,2366,117,115],"class_list":["post-16758","post","type-post","status-publish","format-standard","hentry","category-zuoxcx","tag-icon","tag-398","tag-2366","tag-117","tag-115"],"_links":{"self":[{"href":"https:\/\/www.zhidianwl.com\/zhidian\/wp-json\/wp\/v2\/posts\/16758","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\/25"}],"replies":[{"embeddable":true,"href":"https:\/\/www.zhidianwl.com\/zhidian\/wp-json\/wp\/v2\/comments?post=16758"}],"version-history":[{"count":1,"href":"https:\/\/www.zhidianwl.com\/zhidian\/wp-json\/wp\/v2\/posts\/16758\/revisions"}],"predecessor-version":[{"id":16853,"href":"https:\/\/www.zhidianwl.com\/zhidian\/wp-json\/wp\/v2\/posts\/16758\/revisions\/16853"}],"wp:attachment":[{"href":"https:\/\/www.zhidianwl.com\/zhidian\/wp-json\/wp\/v2\/media?parent=16758"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.zhidianwl.com\/zhidian\/wp-json\/wp\/v2\/categories?post=16758"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.zhidianwl.com\/zhidian\/wp-json\/wp\/v2\/tags?post=16758"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}