ミニプログラムのページを大学の友達や友達の輪と共有する

1.ミニプログラムには、友達のサークルへのネイティブ共有が付属しています

onShareAppMessage: function () {
    
    
	console.log('转发');
},

1.1ボタン共有ボタン

<button class="invitebtn" open-type="share">立即邀请</button>

1.2ボタンボタンをクリックして共有し、招待コードを取得します

onShareAppMessage: async function(res) {
    
    
                        console.log(res);
                        if(res.from == "button"){
    
    
                                let result = await Api.createcode();
                                if(result.data.code == 200){
    
    
                                        this.code = result.data.data.inviteCode
                                        console.log(this.code);
                                }
                                console.log(this.code);
                        }
                        return {
    
    
                                path: '/pages/home/init?inviteCode='+this.code
                        }
                },

2.ネイティブ共有を非表示にする

onLoad(){
    
    
	uni.hideShareMenu()
}

3.モーメントへのネイティブ共有

onShareTimeline() {
    
    },

おすすめ

転載: blog.csdn.net/qq_45894929/article/details/111687048