【功能完善】小程序支持转发到朋友圈

This commit is contained in:
puhui999
2024-11-29 12:44:42 +08:00
parent f98b1a2bea
commit 4c4134389e
+15 -4
View File
@@ -60,12 +60,11 @@
/**
* 模板组件 - 提供页面公共组件,属性,方法
*/
import { computed, reactive, ref } from 'vue';
import { computed } from 'vue';
import sheep from '@/sheep';
import { isEmpty } from 'lodash-es';
import { onShow } from '@dcloudio/uni-app';
// #ifdef MP-WEIXIN
import { onShareAppMessage } from '@dcloudio/uni-app';
import { onShareAppMessage, onShareTimeline, onShow } from '@dcloudio/uni-app';
// #endif
const props = defineProps({
@@ -191,7 +190,11 @@
});
// #ifdef MP-WEIXIN
// 微信小程序分享
uni.showShareMenu({
withShareTicket: true,
menus: ['shareAppMessage', 'shareTimeline'],
});
// 微信小程序分享好友
onShareAppMessage(() => {
return {
title: shareInfo.value.title,
@@ -199,6 +202,14 @@
imageUrl: shareInfo.value.image,
};
});
// 微信小程序分享朋友圈
onShareTimeline(() => {
return {
title: shareInfo.value.title,
query: shareInfo.value.path,
imageUrl: shareInfo.value.image,
};
});
// #endif
onShow(() => {