2025年H5跳小程序的三种方法

H5跳小程序的三种方法1 H5 页面嵌入到小程序中 H5 跳本小程序其他页面 wx miniProgram navigateTo url pages product details from 智能客服微信小程序 amp uits source 智能客服微信小程序 amp productCode code

大家好,我是讯享网,很高兴认识大家。

1、H5页面嵌入到小程序中,H5跳本小程序其他页面

wx.miniProgram.navigateTo({ 
    url: '/pages/product/details?from=智能客服微信小程序&uits_source=智能客服微信小程序&productCode='+ code +'&uits_s01=28&uits_s02=XCX&uits_s03=buy' }) 

讯享网

2、H5页面在服务号内直接跳转其他小程序

需要调用微信jssdk中的方法

讯享网$.ajax({ 
    //jssdk后台签名接口,需要后台提供 url: '/weixinsignature/getWXJWeiXinSignature?url=' + encodeURIComponent(location.href.split('#')[0]) + '&sysNum=' + sysNum + '&wxcId=' + wxcId, type: 'get', success: function (data) { 
    wx.config({ 
    appId: data.appid, timestamp: data.timestamp, nonceStr: data.nonceStr, signature: data.signature, jsApiList: ['startRecord', 'stopRecord', 'onVoiceRecordEnd', 'playVoice', 'translateVoice', 'uploadVoice', 'chooseImage', 'uploadImage'], openTagList: ['wx-open-launch-weapp'] }) ready() } }) 
<wx-open-launch-weapp class="launch-btn" name="'+ name +'" rel="'+ code +'" path="'+ path +'"><template>'+ data +'</template></wx-open-launch-weapp> 

3、H5页面嵌入到小程序中,H5跳其他小程序页面


讯享网

讯享网wx.miniProgram.redirectTo({ 
    url: '/pages/xiaoJi/xiaoJi?productCode='+ code +'&url=' + encodeURIComponent(JSON.stringify(location.href)) }) 

小程序空页面:

onLoad(options) { 
    this.navigateToWxc(options) }, methods:{ 
    navigateToWxc: function(options){ 
    this.url = JSON.parse(decodeURIComponent(options.url)) let programPath; if(options.productCode.indexOf("600") > -1){ 
    programPath = 'pages/global/detail' }else{ 
    programPath = 'pages/product/details' } programPath += '?from=智能客服微信小程序&uits_source=智能客服微信小程序' + '&productCode=' + options.productCode + '&uits_s01=28&uits_s02=XCX&uits_s03=buy' wx.showModal({ 
    title: '提示', content: '是否允许跳转第三方小程序?', success (res) { 
    if (res.confirm) { 
    wx.navigateToMiniProgram({ 
    appId: programAppId, path: programPath, success(res) { 
    console.log(res) }, fail(err) { 
    console.log(err) } }) } else if (res.cancel) { 
    console.log('用户点击取消') } } }) } } 
小讯
上一篇 2025-04-02 12:00
下一篇 2025-01-11 21:38

相关推荐

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容,请联系我们,一经查实,本站将立刻删除。
如需转载请保留出处:https://51itzy.com/kjqy/72342.html