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 🙏

© 2026 – Pkg Stats / Ryan Hefner

xyj-element

v0.1.2

Published

### 父组件中使用

Readme

xyj-check

父组件中使用

 <xyj-check :config="config" :list="list" :echo-list="echoList" @getList="fn"></xyj-check>
:config 配置选择框 已下均为默认值可以自行修改
   config: {
        is:false,//是否使用默认配置 true使用后 下面配置的都不生效 也可以不配置
        isAll: true,//开启全选
        max: 100,//最多选几个
        min: 0,//最少选几个
        size: 'small',//样式大小 medium / small / mini
        type: 'button',//样式 button border
        textColor: '#fff',//type=button 才生效 字体颜色
        fill: '#123',//type=button 才生效 背景颜色
        isGroup:false//根据后端需要什么数据格式可以设置 false得到[1,2,3] true得到[{name:'长沙',id:1},{name:'武汉',id:2}]
      }
:list 可选择的选项
业务场景1:固定选项 写死参数
  list:[
        {
          name: '长沙',
          id: 1,
          disabled: true //true禁止选择长沙
        },
        {
          name: '武汉',
          id: 2
        },
        {
          name: '泉州',
          id: 3
        }
      ],
业务场景2:不固定选项 从后端api获取
1.假设后端返回的JSON为
  this.cityList=[
        {
          label: '长沙',
          cityId: 1,
        },
        {
          label: '武汉',
          cityId: 2
        },
        {
          label: '泉州',
          cityId: 3
        }
      ]
      //数据处理
        this.list = this.cityList.map(item => {
          return {
              name:item.label,
              id:item.cityId
          };
        });
@getList="fn" 子组件会告诉父组件勾选了哪些

1.比如我们勾选了 长沙
methods:{
    //获取子组件传递的勾选值
    fn(res){
        console.log(res)//[1]||[{name:'长沙',id:1}]
        this.cityList=res//赋值
    }
    //保存按钮
    save(){
        const data={
           cityList:this.cityList 
        }
        ...发起请求给后端传参
    }
}
:echoList 回显数据
业务场景:请求后端api保存后 一般查看详情进行之前保存的修改 需要回显告诉我们之前选择了哪几个
1.假设后端返回[{label:'长沙',cityId:1}]这种格式
this.config.isGroup=true//需要设置为true 才能正常回显

2.假设后端返回[1,2,3]这种格式
this.config.isGroup=false//需要设置为false 才能正常回显

3.假设我们之前选的是长沙,后端详情api返回的JSON为
  this.cityList=[
        {
          label: '长沙',
          cityId: 1,
          checkd:true
        },
        {
          label: '武汉',
          cityId: 2,
          checkd:false
        },
        {
          label: '泉州',
          cityId: 3,
          checkd:false
        }
      ]
      
    //1.isGroup=false数据处理
    this.echoList=[]
    this.echoList = this.cityList.map(item => {
         if(item.checkd){
             this.echoList.push(item.cityId)
         }
    });
    console.log(this.echoList)//[1] 成功回显
    
    //2.isGroup=true数据处理
    this.echoList=[]
    this.echoList = this.cityList.map(item => {
         if(item.checkd){
             this.echoList.push({name:item.label,id:item.cityId})
         }
    });
    console.log(this.echoList)//[{name:"长沙",id:1}] 成功回显