微信小程序快速接入微信web-view控件
2018-04-27|HiShop
導(dǎo)讀:微信web-view控件是微信同意接入的一個(gè)新控件,那么要怎么操作快速接入微信web-view控件...
微信web-view控件是微信同意接入的一個(gè)新控件,那么要怎么操作快速接入微信web-view控件
- 小程序內(nèi)嵌網(wǎng)頁
- 小程序可關(guān)聯(lián)500個(gè)公眾號 內(nèi)嵌網(wǎng)頁的支持使微信從單個(gè)App成為名符其實(shí)的平臺更近了一步,趕緊來嘗鮮下,web-view 官方文檔地址
一,更新<微信開發(fā)者工具>至最新版
由于web-view 組件是由基礎(chǔ)庫 1.6.4 開始支持,而在當(dāng)前<微信開發(fā)者工具>版本點(diǎn)擊右側(cè)'詳情'按鈕可以看到僅支持到1.5.4:




二,配置業(yè)務(wù)域名(也就是訪問的白名單)
a:開發(fā)者登錄小程序后臺mp.weixin.qq.com,選擇設(shè)置-開發(fā)設(shè)置-業(yè)務(wù)域名,新增配置域名模塊


B9A00B7A-0E67-4C8B-BF49-0452175CA176.jpeg
三,新建測試頁面wxml,使用web-view控件,并設(shè)置src地址為上面配置的域名:
這里會自動鋪滿整個(gè)頁面,并覆蓋其他組件。所以無需其他代碼
四,大功告成

常見問題:

出現(xiàn)該錯(cuò)誤就是說web-view里面訪問的域名沒有成功配置,建議檢查步驟三