欢迎来到尧图网

客户服务 关于我们

您的位置:首页 > 财经 > 创投人物 > uniapp app打开小程序/app分享小程序卡片

uniapp app打开小程序/app分享小程序卡片

2025/6/21 10:28:58 来源:https://blog.csdn.net/weixin_45811884/article/details/148733121  浏览:    关键词:uniapp app打开小程序/app分享小程序卡片

app打开小程序

plus.share.getServices(function(services) {var service = services.find(function(service) {return service.id === 'weixin';});if (service) {service.launchMiniProgram({id: 'gh_**********02', // 替换为实际的小程序"原始id"success: function() {console.log('成功打开小程序');},fail: function(err) {console.error('打开小程序失败', err);}});} else {console.log('未找到微信服务');}
}, function(err) {console.error('获取分享服务失败', err);
});

小程序打开另一个小程序

uni.navigateToMiniProgram({appId: 'wx7a*************', // 替换为实际的小程序appIdpath: 'pages/index/index', // 小程序打开的页面路径,默认为首页extraData: {foo: 'bar' // 需要传递给目标小程序的数据,目标小程序可在App.onLaunch(),App.onShow()中获取到这份数据},// envVersion: 'develop', // 打开的小程序的版本。仅在当前小程序为开发版或体验版时此参数有效。如果当前小程序是正式版,则打开的小程序必定是正式版。success(res) {// 打开成功console.log('成功打开小程序', res);},fail(err) {// 打开失败console.error('打开小程序失败', err);}
});

app分享小程序卡片

uni.share({provider: 'weixin',scene: "WXSceneSession", //仅支持分享好友type: 5,title: '你好',imageUrl: 'https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/share-logo@3.png',miniProgram: {id: 'gh_abcdefg', // 原始idpath: 'pages/index/index',type: 0,webUrl: 'http://uniapp.dcloud.io' //必须得有,地址随便},success: ret => {console.log(JSON.stringify(ret));}
});

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

热搜词