更新记录
1.0.0(2025-03-13)
- 初始化
平台兼容性
Vue2 | Vue3 |
---|---|
√ | √ |
App | 快应用 | 微信小程序 | 支付宝小程序 | 百度小程序 | 字节小程序 | QQ小程序 |
---|---|---|---|---|---|---|
Android:5.0,iOS:12,HarmonyNext:不确定 | × | × | × | × | × | × |
钉钉小程序 | 快手小程序 | 飞书小程序 | 京东小程序 | 鸿蒙元服务 |
---|---|---|---|---|
× | × | × | × | × |
H5-Safari | Android Browser | 微信浏览器(Android) | QQ浏览器(Android) | Chrome | IE | Edge | Firefox | PC-Safari |
---|---|---|---|---|---|---|---|---|
× | × | × | × | × | × | × | × | × |
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') })