更新记录

1.0.1(2026-07-03)

  • 新增 filterApp 参数,支持过滤分享应用列表
  • filterApp 可传入 true 过滤当前应用,或传入字符串数组按包名过滤
  • 注意:filterApp 仅 Android 13+(API 33+)生效,iOS 仅做参数兼容无实际过滤效果

1.0.0(2026-07-02)

  • 初始版本
  • 支持文本、链接、图片、视频、音频、文件分享
  • 支持 Android 和 iOS 平台

平台兼容性

uni-app(5.07)

Vue2 Vue3 Chrome Safari app-vue app-nvue Android iOS 鸿蒙
- - - - - - 5.0 14 -
微信小程序 支付宝小程序 抖音小程序 百度小程序 快手小程序 京东小程序 鸿蒙元服务 QQ小程序 飞书小程序 小红书小程序 快应用-华为 快应用-联盟
- - - - - - - - - - - -

uni-app x(5.07)

Chrome Safari Android iOS 鸿蒙 微信小程序
- - 5.0 14 - -

其他

多语言 暗黑模式 宽屏模式 蒸汽模式
× × × √

cc-share

原生系统级别分享插件,支持 Android 和 iOS 平台。

功能

  • 分享文本
  • 分享链接
  • 分享图片(单张/多张)
  • 分享视频(单个/多个)
  • 分享音频(单个/多个)
  • 分享文件(单个/多个)

平台兼容性

Android iOS
4.33+ 4.33+

filterApp 参数仅在 Android 13+(API 33+)上生效,iOS 仅做参数兼容,无实际过滤效果。

使用方法

import { shareWithSystem } from "@/uni_modules/cc-share"

// 分享文本
shareWithSystem({
  summary: "Hello World",
  type: 'text',
  success(res) {
    console.log("分享成功", res.errMsg)
  },
  fail(err) {
    console.log("分享失败", err.errCode, err.errMsg)
  }
})

// 分享链接
shareWithSystem({
  href: "https://uniapp.dcloud.io",
  type: 'text',
  success(res) {
    console.log("分享成功")
  }
})

// 分享单张图片
shareWithSystem({
  imageUrl: "/static/test-image/logo.png",
  type: 'image'
})

// 分享多张图片
shareWithSystem({
  imagePaths: ["/static/img1.png", "/static/img2.png"],
  type: 'image'
})

// 分享视频
shareWithSystem({
  videoPaths: ["/static/video.mp4"],
  type: 'video'
})

// 分享音频
shareWithSystem({
  audioPaths: ["/static/audio.mp3"],
  type: 'audio'
})

// 分享文件
shareWithSystem({
  filePaths: ["/static/file.zip"],
  type: 'file'
})

// 同时分享链接、文本和图片
shareWithSystem({
  summary: "欢迎使用uni-app",
  href: "https://uniapp.dcloud.io",
  imagePaths: ["/static/image.png"],
  type: 'image'
})

// 过滤当前应用(仅 Android 13+ 生效)
shareWithSystem({
  summary: "分享文本",
  filterApp: true
})

// 过滤指定包名的应用(仅 Android 13+ 生效)
shareWithSystem({
  summary: "分享文本",
  filterApp: ["com.tencent.mm", "com.tencent.mobileqq"]
})

参数说明

参数 类型 必填 说明
type string 否 分享类型,默认为 text。可选值:text、image、video、audio、file
summary string 否 分享的文字内容
href string 否 分享链接,必须以 http:// 或 https:// 开头
imageUrl string 否 分享单个图片,仅支持本地路径
imagePaths Array\<string> 否 分享多张图片,仅支持本地路径
videoPaths Array\<string> 否 分享视频,仅支持本地路径
audioPaths Array\<string> 否 分享音频,仅支持本地路径
filePaths Array\<string> 否 分享文件,仅支持本地路径
filterApp boolean | Array\<string> 否 过滤应用列表。传入 true 过滤当前应用,传入字符串数组按包名过滤。仅 Android 13+ 生效,iOS 仅做参数兼容
success Function 否 成功回调
fail Function 否 失败回调
complete Function 否 完成回调

错误码

错误码 说明
1310600 取消分享
1310601 分享内容不可以为空
1310602 系统分享出错
1310603 图片路径无效
1310604 无效的链接
1310605 video 路径无效
1310606 file 文件不存在
1310607 audio 路径无效

隐私、权限声明

1. 本插件需要申请的系统权限列表:

无

2. 本插件采集的数据、发送的服务器地址、以及数据用途说明:

插件不采集任何数据

3. 本插件是否包含广告,如包含需详细说明广告表达方式、展示频率:

无

暂无用户评论。