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')
})