zoukankan      html  css  js  c++  java
  • 微信小程序分享好友和朋友圈

    注意:安卓支持分享好友和朋友圈,ios不支持分享朋友圈

    在需要分享的页面js的onLoad中

        wx.showShareMenu({ menus: ['shareAppMessage', 'shareTimeline'] // 分享好友、朋友圈 }) 
    /**
       * 用户点击右上角分享
       */
      onShareAppMessage (res) {
        return {
          title: '自定义,一般写小程序的名字',
          path: 'pages/index/index',
          // imageUrl:'这个是显示的图片,不写就默认当前页面的截图',
          success: function (shareTickets) {
            console.info(shareTickets + '成功');
            // 转发成功
          },
          fail: function (res) {
            console.log(res + '失败');
            // 转发失败
          },
          complete:function(res){
            // 不管成功失败都会执行
          }
        }
      },

    如果不想要页面分享,在不需要分享的页面js的onLoad中

     wx.hideShareMenu({
          menus: ['shareAppMessage', 'shareTimeline']
        })
    设置分享:
    wx.showShareMenu()
    禁止分享 wx.hideShareMenu()
  • 相关阅读:
    The while statement
    App server 与 Web server之间的区别
    Keyboard input
    Recursion
    Conditionals
    TurtleWorld Exercises
    Python TurtleWorld configuration and simple test
    Why functions
    The python programing language
    性能测试3 方法
  • 原文地址:https://www.cnblogs.com/lude1994/p/14993838.html
Copyright © 2011-2022 走看看