小程序點擊跳轉外部頁面web
1.index.wxml 添加點擊事件 標籤能夠是小程序支持的json
<!-- 邀請好友 --> <cover-image src='/img/invitation.png' class='img-invitation' bindtap='invitation'></cover-image>
2.index.js 添加事件 小程序
invitation: function () { var that = this; wx.showModal({ title: '提示', content: '請下載APP', success(res){ if(res.confirm){ wx.navigateTo({ url: '/pages/out/out', }) } else if (res.cancel){ console.log('用戶點擊取消') } } }) },
注:頁面跳轉是 url: '/pages/out/out', 因此須要在app.json中配置微信小程序
{ "pages":[ "pages/index/index", "pages/out/out" ], }
3.在out.wxml 添加一句話web-view標籤 其中src是須要跳轉的連接服務器
<web-view src="https://www.xiaojingxiche.com/Integral/download"></web-view>
<!-- 放心你沒有看錯就這麼一行就好了 -->
這樣寫好以後還不算完 會提示如圖微信
接下來須要在微信小程序後臺配置業務域名微信開發
1.登陸微信公衆號開發平臺 開發-->開發設置-->業務域名app
須要下載校檢文件上傳至服務器指定目錄,進行保存.校驗文件 ###.txt
文件下載.上傳到域名根目錄.點擊保存便可.工具
保存完成便可,完成以後能夠在微信開發者工具中查看到即配置成功this