利用URL Scheme接口無感跳轉(zhuǎn)微信小程序
首先想要跳轉(zhuǎn)到微信小程序得先知道AppID和secret
如果不知道的情況下是無法跳轉(zhuǎn)的
urlscheme.generate
此時遇到一個問題是獲取auth.getAccessToken
appid 此值在小程序里就可以獲取 到



secret 這個值只能在可在 微信公眾平臺 - 設(shè)置 - 開發(fā)設(shè)置 里面找到
接下來放代碼
this.$axios
.get(
'https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=wxd596b98e0b20485c&secret=6ae04f87570c3f1674290d788d1f8fb9'
)
.then((res) => {
let access_token = res.data.access_token;
this.$axios
.post('https://api.weixin.qq.com/wxa/generatescheme?access_token=' + access_token, {
jump_wxa: {},
expire_type: 1,
expire_time: 24 * 60 * 1000,
expire_interval: 1,
})
.then((res) => {
location.href = res.openlink
});
});
這樣就可以在手機瀏覽器里直接跳轉(zhuǎn)到微信小程序了文章來源:http://www.zghlxwxcb.cn/news/detail-605467.html
如果有其他更好的方法,請留言~文章來源地址http://www.zghlxwxcb.cn/news/detail-605467.html
到了這里,關(guān)于h5頁面跳轉(zhuǎn)到微信小程序之利用URL Scheme接口的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!