HWH5.addEventListener

支持版本>=10.0.2

可以设置导航栏分享的内容,可将We码分享到群组或个人,若对分享内容不做任何设置则分享默认内容。

请求参数

参数 类型 必填 说明
title String 标题,默认为We码名称
desc String 简介或副标题,默认为We码在开放平台的简介
h5Uri String 分享后移动端打开的链接,默认为plugin.json的indexURL
pcUri String 分享后PC端打开的链接
isPCDisplay Number 是否需要在PC端espace显示分享消息,1:显示 0:不显示,默认为0
iconURL String 分享图标,默认为We码logo
from String 内容来源;默认为“We码”

返回说明

请求示例

  • ES6版本

    HWH5.removeEventListenerByType('share');
    HWH5.addEventListener({
      type: 'share',
      func: () => ({
        title: '公司公告',
        desc: 'xxx',
        h5Uri: 'h5://xxxxx/html/index.html',
        pcUri: 'www.baidu.com',
        isPCDisplay: 1,
        iconURL: 'xxx.jpg',
        from: 'welink'
      })
    });
    
  • ES5版本

    HWH5.removeEventListenerByType('share');
    HWH5.addEventListener({
      type: 'share',
      func: function() {
        return {
          title: '公司公告',
          desc: 'xxx',
          h5Uri: 'h5://xxxxx/html/index.html',
          pcUri: 'www.baidu.com',
          isPCDisplay: 1,
          iconURL: 'xxx.jpg',
          from: 'welink'
        }
      }
    });
    

结果。 ""

    无结果。 ""