8***@qq.com
8***@qq.com
  • 发布:2023-05-05 08:19
  • 更新:2023-12-16 17:36
  • 阅读:455

uni.share scene设置为WXSceneTimeline无法分享到朋友圈,实际操作时弹出分享给微信好友

分类:uni-app

产品分类: uniapp/App

PC开发环境操作系统: Windows

PC开发环境操作系统版本号: 21H2

HBuilderX类型: 正式

HBuilderX版本号: 3.7.11

手机系统: iOS

手机系统版本号: iOS 15

手机厂商: 苹果

手机机型: iphone13

页面类型: vue

vue版本: vue2

打包方式: 离线

项目创建方式: HBuilderX

示例代码:

按钮

<view class="text-center">  
                <button class='cu-btn cuIcon bg-green lg' @tap='shareSession' open-type="share">  
                    <text class='cuIcon-weixin' style='font-size: 44upx;'></text>  
                </button>  
                <view class="padding-tb">  
                    微信好友  
                </view>  
            </view>  
            <view class="text-center">  
                <button class='cu-btn cuIcon bg-green lg' @tap='shareTimeline' open-type="share">  
                    <text class='iconfont icon-pengyouquan' style='font-size: 44upx;'></text>  
                </button>  
                <view class="padding-tb">  
                    朋友圈  
                </view>  
            </view>  

js

shareSession() {  
uni.share({  
                    provider: "weixin",  
                    scene: "WXSceneSession",  
                    type: 2,  
                    imageUrl: this.imagepath,  
                    success: function(res) {  
                        console.log("success:" + JSON.stringify(res));  
                    },  
                    fail: function(err) {  
                        console.log("fail:" + JSON.stringify(err));  
                    }  
                });  
            },  
            shareTimeline() {  
                uni.share({  
                    provider: "weixin",  
                    scene: "WXSceneTimeline",  
                    type: 2,  
                    imageUrl: this.imagepath,  
                    success: function(res) {  
                        console.log("success:" + JSON.stringify(res));  
                    },  
                    fail: function(err) {  
                        console.log("fail:" + JSON.stringify(err));  
                    }  
                });  
            },

操作步骤:

运行到小程序点击朋友圈按钮

预期结果:

分享到朋友圈

实际结果:

分享给微信好友

bug描述:

uni.share 页面中两个按钮一个分享给微信好友,一个分享到朋友圈,但是点击后不管是开发工具还是手机都显示【分享到朋友圈】都弹出了分享给好友界面

2023-05-05 08:19 负责人:无 分享
已邀请:

最佳回复

HRK_01

HRK_01

要仔细看官方文档哦,uni.share是不支持小程序的
分享朋友圈不支持自定义按钮触发,只能右上角的三个点拉起

jadeCat

jadeCat

建议仔细看看这个https://uniapp.dcloud.net.cn/api/plugins/share.html

  • 8***@qq.com (作者)

    看不出来,我一开始就是看这个写的

    2023-05-05 14:35

Edison丶Rr

Edison丶Rr

你好,我也遇到同样的问题,请问解决了吗?

g***@qianjiangcloud.com

g***@qianjiangcloud.com

请问有人解决了嘛

喜欢技术的前端

喜欢技术的前端 - QQ---445849201

可以分享到朋友圈

<template>  
    <view class="container">  
        <button @click="shareWx">shareWx</button>  
        <button @click="shareWxQ">shareWxQ</button>  
    </view>  
</template>  

<script>  
    export default {  
        data() {  
            return {  

            }  
        },  
        methods: {  
            shareWx() {  
                uni.share({  
                    provider: "weixin",  
                    scene: "WXSceneSession",  
                    type: 2,  
                    imageUrl: 'https://ask.dcloud.net.cn/uploads/nav_menu/10.jpg',  
                    success: function(res) {  
                        console.log("success:" + JSON.stringify(res));  
                    },  
                    fail: function(err) {  
                        console.log("fail:" + JSON.stringify(err));  
                    }  
                });  
            },  
            shareWxQ() {  
                uni.share({  
                    provider: "weixin",  
                    scene: "WXSceneTimeline",  
                    type: 2,  
                    imageUrl: 'https://ask.dcloud.net.cn/uploads/nav_menu/10.jpg',  
                    success: function(res) {  
                        console.log("success:" + JSON.stringify(res));  
                    },  
                    fail: function(err) {  
                        console.log("fail:" + JSON.stringify(err));  
                    }  
                });  
            },  
        }  
    }  
</script>  

<style scoped>  

</style>
  • HRK_01

    你这个视频里面的是APP端吧,题主说的是小程序端哦

    2023-12-16 17:29

该问题目前已经被锁定, 无法添加新回复