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

在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){

    ] // 所有要调用的 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方法里面

相关文章:

  • 2021-12-22
  • 2021-11-20
  • 2021-04-26
  • 2022-12-23
  • 2022-12-23
  • 2021-11-13
  • 2021-07-23
猜你喜欢
  • 2021-10-16
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-29
相关资源
相似解决方案