获取URLLink实现链接跳转小程序
uni.request(
{
url:`https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=appid&secret=secret`,
method: 'GET',
success: ((res) =>{
console.log(res)
uni.request(
{
url:'https://api.weixin.qq.com/wxa/generate_urllink?access_token=' + res.data.access_token,
method: 'POST',
data: {
path: 'pages/welcome/index',
},
success: ((res2) => {
console.log(res2)
// 访问微信中间页面,点击进入小程序,携带参数访问微信小程序指定页面
// location.href = res2.data.url_link
})
}
)
})