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

pull/126/head
puhui999 2024-11-29 12:44:42 +08:00
parent f98b1a2bea
commit 4c4134389e
1 changed files with 15 additions and 4 deletions

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(() => {