zoukankan      html  css  js  c++  java
  • uni-app 第三方应用中调起微信分享

    最近做项目的时候遇到一个问题

    在APP中的某个单独的小项目中使用uni-app写的项目调起微信分享

    单独引入jweixin-1.6.0.js在需要分享的页面中时,

    页面会报错,导致原有的数据都没有展示出来;

    可以使用第三地方组件

    npm install jweixin-module --save

    安装微信分享模块

    安装完成后你会得到一个jweixin-module 的包,

    然后

    import wx from "@/jweixin-module/jweixin-module/lib/index.js"

    在页面中引入模块

    wxShare(config, news, users){

      var _this = this;
      //微信分享
      wx.config({
        appId: config.appId,
        timestamp: config.timestamp,
        nonceStr: config.nonceStr,
        signature: config.signature,
        debug: config.debug,
        jsApiList: ["onMenuShareTimeline", "onMenuShareAppMessage", "onMenuShareQQ", "onMenuShareWeibo", "chooseImage",
        "uploadImage", "hideMenuItems", "closeWindow"
        ] // 所有要调用的 API 都要加到这个列表中
      });
      wx.ready(function() {
      // 在这里调用 API
      wx.hideMenuItems({
        menuList: ['menuItem:copyUrl', 'menuItem:favorite', 'menuItem:originPage', 'menuItem:openWithQQBrowser','menuItem:openWithSafari', 'menuItem:share:email', 'menuItem:share:qq', 'menuItem:share:weiboApp','menuItem:share:QZone'
        ] // 要隐藏的菜单项,只能隐藏“传播类”和“保护类”按钮,所有menu项见附录3,分享朋友:'menuItem:share:appMessage',分享朋友圈:'menuItem:share:timeline'
      });

      wx.onMenuShareTimeline({ //分享到朋友圈
        *******
      });

      wx.onMenuShareAppMessage({ //分享给朋友
        ****
      });
      });
    ;

    注意:

    wx.config不要放到wx.ready方法里面

  • 相关阅读:
    Python的__init__.py用法
    Python中文
    使用apache进行域名绑定
    Storm入门之第二章
    Storm入门之第一章
    【RabbitMQ+Python入门经典】兔子和兔子窝 笔记
    RabbitMQ之Topics(多规则路由)
    RabbitMQ之比较好的资料
    RabbitMQ之路由
    RabbitMQ之发布订阅
  • 原文地址:https://www.cnblogs.com/yeziyou/p/13740374.html
Copyright © 2011-2022 走看看