From 4c4134389e14c385ac5a0c6d7f49963bd9af9bac Mon Sep 17 00:00:00 2001 From: puhui999 Date: Fri, 29 Nov 2024 12:44:42 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E5=8A=9F=E8=83=BD=E5=AE=8C=E5=96=84?= =?UTF-8?q?=E3=80=91=E5=B0=8F=E7=A8=8B=E5=BA=8F=E6=94=AF=E6=8C=81=E8=BD=AC?= =?UTF-8?q?=E5=8F=91=E5=88=B0=E6=9C=8B=E5=8F=8B=E5=9C=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sheep/components/s-layout/s-layout.vue | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/sheep/components/s-layout/s-layout.vue b/sheep/components/s-layout/s-layout.vue index 3fc666fa..6f5d3a24 100644 --- a/sheep/components/s-layout/s-layout.vue +++ b/sheep/components/s-layout/s-layout.vue @@ -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(() => {