Button will jump to login when you are not logged in when sharing.

<view @tap="beforeShare">
    <button :open-type="isshare">分享</button>
</view>

<script>
export default{
    data(){
        isshare:''
    },
    methods:{
        beforeShare(){
            if(!this.$store.getters.loginStatus){ //loginStatus登录状态
                uni.showToast({
                    icon:'none',
                    title:'请先登录'
                })
                setTimeout(()=>{
                    uni.navigateTo({url:'/pages/auth/auth'})
                },2000)
            }else{
                this.isshare = 'share'
            }
        }
    }
}
</script>

The sharing in the upper right corner can be hidden using uni.hideShareMenu() in onLaunch of App.vue, and then uni.showShareMenu() when the login is successful.

Guess you like

Origin blog.csdn.net/xiyan_yu/article/details/129688670