From f8f1139dcf5c20570828b6c85641ba6a1d556283 Mon Sep 17 00:00:00 2001 From: Burt <1020103647@qq.com> Date: Wed, 3 Jan 2024 14:34:31 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E5=88=86=E4=BA=AB):=20=E5=BC=80=E5=8F=91?= =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E5=B0=8F=E7=A8=8B=E5=BA=8F=E5=88=86=E4=BA=AB?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- src/pages/index/index.vue | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index cea05b4..3039aa0 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ - [ ] 页面悬浮球 - [ ] 导航栏返回or去首页 - [ ] 自定义导航栏顶部机型适配 -- [ ] 微信小程序分享(好友+朋友圈) +- [x] 微信小程序分享(好友+朋友圈) - [ ] 多tab列表功能 - [ ] 抽奖转盘 diff --git a/src/pages/index/index.vue b/src/pages/index/index.vue index f0407b7..10a3640 100644 --- a/src/pages/index/index.vue +++ b/src/pages/index/index.vue @@ -25,7 +25,7 @@ import { ref } from 'vue' import { useCountStore, useUserStore } from '@/store' import { http } from '@/utils/http' import { UserItem } from '@/typings' -import { onShareAppMessage } from '@dcloudio/uni-app' +import { onShareAppMessage, onShareTimeline } from '@dcloudio/uni-app' const countStore = useCountStore() const title = ref('Hello') @@ -48,6 +48,7 @@ const handleRequest = () => { }) console.log(res) } +/** 激活“分享给好友” */ onShareAppMessage((options: Page.ShareAppMessageOption): Page.CustomShareContent => { console.log('options:', options) return { @@ -57,6 +58,13 @@ onShareAppMessage((options: Page.ShareAppMessageOption): Page.CustomShareContent 'https://cip-shopping-page-0eysug01066a9e-1302818703.tcloudbaseapp.com/pretty-girl.png', } }) +/** 激活“分享到朋友圈”, 注意:需要先激活“分享给好友” */ +onShareTimeline((): Page.ShareTimelineContent => { + return { + title: '自定义分享标题', + query: 'a=1&b=2', + } +})