前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >nativeshare跳转微信分享

nativeshare跳转微信分享

作者头像
用户10106350
发布2022-10-28 10:15:56
2K0
发布2022-10-28 10:15:56
举报
文章被收录于专栏:WflynnWeb

代码已上传至github

github代码地址:https://github.com/Miofly/mio.git

nativeshare插件使用qq浏览器跳转微信分享方法

代码语言:javascript
复制

<template>
   <view class="bg-white">
      <view @tap="test">12</view>
   </view>
</template>
代码语言:javascript
复制

<script>
    import NativeShare from 'nativeshare'
 
    export default {
        data () {
            return {
                nativeShare: new NativeShare()
            }
        },
        methods: {
         test () {
             // const nativeShare = new NativeShare()
                if (navigator.userAgent.toLowerCase().indexOf('micromessenger') !== -1) {
                    this.ui.showToast('图文分享请打开QQ浏览器', 2)
                } else {
                    try {
                        this.nativeShare.setShareData({
                            // link: 'http://192.168.3.82:8080/#/pages/index/itest',
                            title: 'title111',
                            desc: 'desc11',
                            icon: 'https://t12.baidu.com/it/u=751929707,172094732&fm=76',
                        })
                        this.nativeShare.call('wechatFriend')
                    } catch (err) {
                        console.log(err)
                        this.ui.showToast('此浏览器不支持跳转')
                    }
                }
         },
        },
    }
</script>
本文参与 腾讯云自媒体同步曝光计划,分享自微信公众号。
原始发表:2020-04-24,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 WflynnWeb 微信公众号,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档