Notable Pottery Manufacturer

    kn-wxhelper

    0.0.6 • Public • Published

    微信分享插件

    install

    npm install kn-wxhelper
    or
    <script src="node_modules/kn-wxhelper/lib/index.js"></script>

    usage

    import wxHelper from 'knWxHelper'
    
    wxHelper.init({appId:'xxx'});
    
    wxHelper.setShare({
      title:'',
      desc:'',
      link:'',
      imgUrl:'',
      success:()=>{
      }
    });
    

    or

    <script src="node_modules/kn-wxhelper/lib/index.js"></script>
    ...
    
    var wechatHelper =  window['knWxHelper'].default || window['knWxHelper'];
    wechatHelper.init({
      appId:''
    })
    wechatHelper.setShare({
      title:'分享文案设置',
      desc:'详情内容设置',
      imgUrl:`share.jpg`,
      link:location.href,
      success:()=>{
      }
    });      

    API

    init

    初始化 ({appId,apis?:,hideMenuList?,onSuccess?,onFail?,debug?})=>void

    • appId: "",微信公众号的appId
    • apis?: [],需要开通的api列表,默认值:
      [
        'updateAppMessageShareData',
        'updateTimelineShareData',
        'onMenuShareAppMessage',
        'onMenuShareTimeline',
        'hideOptionMenu',
        'hideMenuItems',
        'onMenuShareWeibo',
        'onMenuShareQZone'
      ] 
    • hideMenuList?: [],需要隐藏的菜单
    • onSuccess?: ()=>void,初始化成功回调
    • onFai?l: ()=>void,初始化失败回调
    • debug?: bool,调试模式,默认值:false

    hideMenuList、apis值参考微信文档

    setShare

    更新分享的内容 ({title,desc,link,imgUrl})=>Promise

    • title: "",标题
    • desc: "",描述
    • link: "",转发的地址
    • imgUrl: "",icon链接

    getAuth 【未开放】

    获取用户授权 ({url:'授权完成跳转链接',appId:'公众号appId'})=>void

    getOpenId 【未开放】

    获取用户openid ()=>{openid:''}

    Keywords

    none

    Install

    npm i kn-wxhelper

    DownloadsWeekly Downloads

    0

    Version

    0.0.6

    License

    none

    Unpacked Size

    279 kB

    Total Files

    10

    Last publish

    Collaborators

    • knplugin