參考
小程序環境
分享 | uni-app官網uni-app,uniCloud,serverless,分享,uni.share(OBJECT),分享到微信聊天界面示例代碼,分享到微信朋友圈示例代碼,uni.share 在App端各社交平臺分享配置說明,uni.shareWithSystem(OBJECT),plus.share.sendWithhttps://uniapp.dcloud.net.cn/api/plugins/share.html#onshareappmessageAPP環境
https://uniapp.dcloud.net.cn/api/plugins/share.html#share
?
例子
<template><view><!-- #ifdef MP --><button open-type="share" :plain="true">點擊小程序分享</button><!-- #endif --><!-- #ifdef APP -->APP環境參考 https://uniapp.dcloud.net.cn/api/plugins/share.html#share<!-- #endif --><!-- #ifdef H5 -->H5環境需自行百度<!-- #endif --></view>
</template><style></style><script setup>// 基礎import { reactive, ref, onMounted } from 'vue'import { onShareAppMessage } from '@dcloudio/uni-app'// 頁面監視 - 分享 - 小程序專用// 參考 https://uniapp.dcloud.net.cn/api/plugins/share.html#onshareappmessageonShareAppMessage((res) => {console.log('>> 分享 > ', JSON.stringify(res))// 返回分享信息return {title: '分享標題XXX',// 頁面 path ,必須是以 / 開頭的完整路徑。注意:京東小程序,開頭不要加'/'path: '/pages/product/detail/?id=1688',// 分享圖標imageUrl: 'https://xx.com/demo.jpg'}})</script>