小程序点击跳转外部页面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