npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

wl-share

v1.1.4

Published

分享组件

Downloads

3

Readme

分享

使用方法

npm install @stl/share

html:
     <div class="share" id="share">
        <em>分享给朋友:</em>
        <i class="share_div" data-bshare='{type:"weixin"}'></i>
        <i class="share_div" data-bshare='{type:"qzone",url:"",title:"",desc:"",summary:"",images:""}'></i>
        <i class="share_div" data-bshare='{type:"weibo",url:"",title:"",desc:"",summary:"",images:""}'></i>   
        <i class="share_div" data-bshare='{type:"qq",url:"",title:"",desc:"",summary:"",images:""}'></i>   
        <i class="share_div" data-bshare='{type:"copy",url:""}'></i>     
    </div>
    <div class="qrcode" data-bshare='{url:""}'></div>
ts:
    import { share } from "@stl/share"
    let shareObj = new share({
        qrcodeBox:document.getElementById("qrcode"),
        qrcodeDeploy:{
            text:"http://www.baidu.com",
            width:200,
            height:200,
            colorDark:"#0000ff",
        }
});

参数说明

    * @param {HTMLElement|string} qrcodeBox 显示微信分享二维码的元素或元素id 如果不传则将生成弹窗显示二维码   
    * @param {object} qrcodeDeploy 微信分享二维码的配置  
          {          
              * @param {number} width  生成二维码的宽度 默认 256  
              * @param {number} height  生成二维码的高度 默认 256  
              * @param {string} colorDark 生成二维码的颜色 默认 "#000000"  
          }     

方法说明

changeQrcode:更新二维码的方法 
调用方法:shareObj.changeQrcode(url)
参数说明:url(要生成二维码的地址)

当实例化“share”时传入了“qrcodeBox”参数 需要更新二维码时调用此方法
如果未传入“qrcodeBox”参数 点击微信分享按钮时二维码会实时更新为当前点击按钮“data-bshare”中的url

备注

此组件将获取所有带"data-bshare"属性的元素  然后根据元素"data-bshare"中"type"的值确定分享类型 可选的分享类型有:   
    1.微信(weixin):将生成微信分享二维码   
    2.微博(weibo):将打开微博分享页面   
    3.qq空间(qzone):将打开qq空间分享页面   
    4.qq(qq):将打开qq分享页面   
    5.复制链接(copy):将复制要分享的链接地址   

"data-bshare"属性值说明
    1.type:分享类型
    2.url:要分享地址 如果不传则分享的地址为当前页面地址
    3.title:分享的标题 type为"weibo","qq","qzone"时需要
    4.desc:分享的描述 type为"weibo","qq","qzone"时需要
    4.summary:分享的说明 type为"weibo","qq","qzone"时需要
    5.images:分享的预览图 type为"weibo","qq","qzone"时需要
    6.pop:是否弹窗显示二维码  当页面同时有弹窗显示二维码和显示在'qrcodeBox'元素时 在需要弹窗显示的微信分享按钮的"data-bshare"上加入"pop:true"

参数中传入的"qrcodeBox"也需要添加"data-bshare"属性 此时只需要"url"一个参数