更新记录
1.0.0(2025-04-08) 下载此版本
- 初始版本发布
 - 支持自定义分享项
 - 支持图标颜色和背景色配置
 - 支持动画效果
 - 使用阿里巴巴矢量图标库
 
平台兼容性
uni-app
| Vue2 | Vue3 | Chrome | Safari | app-vue | app-nvue | Android | iOS | 鸿蒙 | 
|---|---|---|---|---|---|---|---|---|
| √ | - | - | - | - | - | - | - | - | 
| 微信小程序 | 支付宝小程序 | 抖音小程序 | 百度小程序 | 快手小程序 | 京东小程序 | 鸿蒙元服务 | QQ小程序 | 飞书小程序 | 快应用-华为 | 快应用-联盟 | 
|---|---|---|---|---|---|---|---|---|---|---|
| - | - | - | - | - | - | - | - | - | - | - | 
uni-share 分享面板组件
一个基于阿里巴巴矢量图标库的分享面板组件,支持自定义分享项和样式。
安装
- 在插件市场点击下载
 - 在项目中导入插件
 
使用说明
- 在页面中引入组件:
 
<template>
  <view>
    <uni-share 
      :visible.sync="shareVisible" 
      :title="'分享到'" 
      :items="shareItems"
      @select="handleShareSelect"
    />
  </view>
</template>
<script>
import uniShare from '@/uni_modules/uni-share/uni-share.vue'
export default {
  components: {
    uniShare
  },
  data() {
    return {
      shareVisible: false,
      shareItems: [
        { iconClass: 'icon-pengyouquan', text: '朋友圈', color: '#2196F3', bgColor: '#E3F2FD', type: 'moments' },
        { iconClass: 'icon-weixinhaoyou', text: '微信好友', color: '#07C160', bgColor: '#E9F7EF', type: 'wechat' },
        { iconClass: 'icon-jubao', text: '举报', color: '#F44336', bgColor: '#FFEBEE', type: 'report' },
        { iconClass: 'icon-buganxingqu_mian', text: '不感兴趣', color: '#E91E63', bgColor: '#FCE4EC', type: 'dislike' }
      ]
    }
  },
  methods: {
    handleShareSelect(item) {
      // 处理分享选择事件
      switch(item.type) {
        case 'moments':
          // 处理朋友圈分享
          break;
        case 'wechat':
          // 处理微信好友分享
          break;
        case 'report':
          // 处理举报
          break;
        case 'dislike':
          // 处理不感兴趣
          break;
      }
    }
  }
}
</script>
- 在页面样式中引入图标库:
 
<style>
@import url('//at.alicdn.com/t/c/font_4885460_kz1i8sicklc.css');
</style>
组件属性
| 属性名 | 类型 | 默认值 | 说明 | 
|---|---|---|---|
| visible | Boolean | false | 控制分享面板的显示和隐藏 | 
| title | String | '分享到' | 分享面板的标题 | 
| items | Array | [] | 分享项配置数组 | 
items 配置项
每个分享项可以配置以下属性:
| 属性名 | 类型 | 说明 | 
|---|---|---|
| iconClass | String | 图标类名,使用阿里巴巴矢量图标库的图标 | 
| text | String | 分享项文本 | 
| color | String | 图标颜色 | 
| bgColor | String | 图标背景颜色 | 
| type | String | 分享项类型,用于区分不同的分享操作 | 
事件
| 事件名 | 说明 | 返回值 | 
|---|---|---|
| select | 选择分享项时触发 | 选中的分享项配置对象 | 
| update:visible | 更新 visible 状态时触发 | 新的 visible 值 | 
样式说明
组件使用 rpx 作为单位,支持响应式布局。主要样式包括:
- 分享面板背景色: #ffffff
 - 标题文字大小: 16px
 - 图标大小: 28px
 - 分享项图标背景圆角: 50rpx
 - 分享项文字大小: 12px
 
目录结构说明
插件包含以下目录:
uni_modules/uni-share: 主要组件目录uni-share.vue: 主组件文件README.md: 说明文档package.json: 组件配置
components/hi-button: 兼容目录hi-button.vue: 兼容包装组件readme.md: 兼容说明
注意:
components/hi-button目录是为了满足插件市场的目录结构要求而创建的,实际使用时推荐直接使用uni_modules/uni-share中的组件。
打包说明
打包上传插件市场时,请确保包含以下目录:
uni_modules/uni-share目录components/hi-button目录
两个目录缺一不可,否则可能会导致上传失败。
注意事项
- 组件依赖阿里巴巴矢量图标库,请确保网络连接正常
 - 图标类名需要与阿里巴巴矢量图标库中的图标名称保持一致
 - 建议在页面中统一引入图标库 CSS,避免重复引入
 - 打包时必须包含 
components/hi-button目录 
示例图片
[示例图片链接]
更新日志
v1.0.0
- 初始版本发布
 - 支持自定义分享项
 - 支持图标颜色和背景色配置
 - 支持动画效果
 - 使用阿里巴巴矢量图标库
 

                                                                    
                                                                        收藏人数:
                                    
                                                        下载插件并导入HBuilderX
                                                    
                                        赞赏(0)
                                    
                                            
 下载 5
                
 赞赏 0
                
            
                    下载 10678808 
                
                        赞赏 1797 
                    
            
            
            
            
            
            
            
            
            
            
            
            
            
            
                        
                                赞赏
                            
            
京公网安备:11010802035340号