更新记录
1.0.0(2025-03-13)
- 初始化
平台兼容性
uni-app(4.02)
Vue2 | Vue3 | Chrome | Safari | app-vue | app-nvue | Android | iOS | 鸿蒙 |
---|---|---|---|---|---|---|---|---|
√ | √ | - | - | - | - | 5.0 | 12 | - |
微信小程序 | 支付宝小程序 | 抖音小程序 | 百度小程序 | 快手小程序 | 京东小程序 | 鸿蒙元服务 | QQ小程序 | 飞书小程序 | 快应用-华为 | 快应用-联盟 |
---|---|---|---|---|---|---|---|---|---|---|
× | × | × | × | × | × | - | × | × | × | × |
uni-app x(4.02)
Chrome | Safari | Android | iOS | 鸿蒙 | 微信小程序 |
---|---|---|---|---|---|
- | - | 5.0 | 12 | - | × |
jagger-share
配置
调用系统分享,无需添加share模块
- 安卓
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
- ios
本地文件只允许分享App 沙盒目录(Documents、tmp、Library等)
使用
- 可分享文本、图片,视频,音频,文档等其他本地文件(远程文件请先用uni.downloadFile下载至本地再调用分享)
-
path入参为本地文件路径,务必保证您了解文件路径结构,可尝试使用plus.io.convertLocalFileSystemURL转换之后传入;
参数名 类型 必填 说明 type String 否 分享类型,支持text,image,audio, video, pdf, word, file, 默认为file title String 否 分享弹窗标题(仅安卓可用) summary String 否 分享的文字内容 path String 否 本地路径 success Function 否 接口调用成功的回调 fail Function 否 接口调用失败的回调函数 complete Function 否 接口调用结束的回调函数(调用成功、失败都会执行) import {shareWithSystem} from '@/uni_modules/jagger-share' // 分享文本 shareWithSystem({ type: 'text', title: '分享弹窗标题', summary: '这个是分享文本内容' }) // 分享图片 shareWithSystem({ type: 'image', title: '分享弹窗标题', path: plus.io.convertLocalFileSystemURL('_doc/xxx.png') }) // 分享视频 shareWithSystem({ type: 'video', title: '分享弹窗标题', path: plus.io.convertLocalFileSystemURL('_doc/xxx.mp4') }) // 分享音频 shareWithSystem({ type: 'audio', title: '分享弹窗标题', path: plus.io.convertLocalFileSystemURL('_doc/xxx.mp3') }) // 分享文档 shareWithSystem({ type: 'word', title: '分享弹窗标题', path: plus.io.convertLocalFileSystemURL('_doc/xxx.docx') }) // 分享PDF shareWithSystem({ type: 'pdf', title: '分享弹窗标题', path: plus.io.convertLocalFileSystemURL('_doc/xxx.pdf') }) // 分享其他文件 shareWithSystem({ type: 'file', title: '分享弹窗标题', path: plus.io.convertLocalFileSystemURL('_doc/xxx.md') })