更新记录

0.0.5(2023-09-11)

  • 增加圆角

0.0.4(2023-08-30)

  • 安卓端布局优化

0.0.3(2023-08-25)

  • 将分享事件回调给宿主App
查看更多

平台兼容性

Vue2 Vue3
App 快应用 微信小程序 支付宝小程序 百度小程序 字节小程序 QQ小程序
HBuilderX 3.7.11 app-vue app-nvue × × × × × ×
钉钉小程序 快手小程序 飞书小程序 京东小程序
× × × ×
H5-Safari Android Browser 微信浏览器(Android) QQ浏览器(Android) Chrome IE Edge Firefox PC-Safari
× × × × × × × × ×

本功能基于底部图标菜单封装而成。

示例代码

<template>
    <button type="default" @click="uniShare">显示</button>
</template>
<script>
    import uniShare from '@/uni_modules/uni-share/js_sdk/uni-share.js';
    export default {
        onBackPress({from}) {
            console.log(from);
            if(from=='backbutton'){
                this.$nextTick(function(){
                    uniShare.hide()
                })
                return uniShare.isShow;
            }
        },
        methods: {
            uniShare() {
                uniShare.show({
                    content: { //公共的分享参数配置  类型(type)、链接(herf)、标题(title)、summary(描述)、imageUrl(缩略图)
                        type: 0,
                        href: 'https://uniapp.dcloud.io/',
                        title: '标题',
                        summary: '描述',
                        imageUrl: 'https://img-cdn-aliyun.dcloud.net.cn/stream/icon/__UNI__HelloUniApp.png'
                    },
                    menus: [{
                            "img": "/static/app-plus/sharemenu/wechatfriend.png",
                            "text": "微信好友",
                            "share": { //当前项的分享参数配置。可覆盖公共的配置如下:分享到微信小程序,配置了type=5
                                "provider": "weixin",
                                "scene": "WXSceneSession"
                            }
                        },
                        {
                            "img": "/static/app-plus/sharemenu/wechatmoments.png",
                            "text": "微信朋友圈",
                            "share": {
                                "provider": "weixin",
                                "scene": "WXSceneTimeline"
                            }
                        },
                        {
                            "img": "/static/app-plus/sharemenu/mp_weixin.png",
                            "text": "微信小程序",
                            "share": {
                                provider: "weixin",
                                scene: "WXSceneSession",
                                type: 5,
                                miniProgram: {
                                    id: '123',
                                    path: '/pages/list/detail',
                                    webUrl: '/#/pages/list/detail',
                                    type: 0
                                },
                            }
                        },
                        {
                            "img": "/static/app-plus/sharemenu/weibo.png",
                            "text": "微博",
                            "share": {
                                "provider": "sinaweibo"
                            }
                        },
                        {
                            "img": "/static/app-plus/sharemenu/qq.png",
                            "text": "QQ",
                            "share": {
                                "provider": "qq"
                            }
                        },
                        {
                            "img": "/static/app-plus/sharemenu/copyurl.png",
                            "text": "复制",
                            "share": "copyurl"
                        },
                        {
                            "img": "/static/app-plus/sharemenu/more.png",
                            "text": "更多",
                            "share": "shareSystem"
                        }
                    ],
                    cancelText: "取消分享",
                }, e => { //callback
                    console.log(uniShare.isShow);
                    console.log(e);
                })
            }
        }
    }
</script>

隐私、权限声明

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

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

插件不采集任何数据

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

许可协议

MIT协议

暂无用户评论。

使用中有什么不明白的地方,就向插件作者提问吧~ 我要提问