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 🙏

© 2025 – Pkg Stats / Ryan Hefner

xsd-drop-items

v1.2.4

Published

1. xsd-drop-items 是一个下拉菜单组件。 2. 这个组件具有非常良好的动画效果。 3. 这个组件的功能齐全,简单好用,欢迎使用 4. 反馈意见请发送至 [email protected] ,我们将进行快速迭代。

Readme

1. 组件介绍

  1. xsd-drop-items 是一个下拉菜单组件。
  2. 这个组件具有非常良好的动画效果。
  3. 这个组件的功能齐全,简单好用,欢迎使用
  4. 反馈意见请发送至 [email protected] ,我们将进行快速迭代。

2. 组件使用

2.1 安装

  1. npm i xsd-drop-items

2.2 引入方式

  1. 组件内引入
<script>
    import { xsdDropItems } from 'xsd-drop-items'
    export default {
        components: {
            xsdDropItems
        },
    }
</script>
  1. 全局按需引入

import { xsdDropItems } from 'xsd-drop-items'
Vue.component('xsd-drop-items', xsdDropItems)
  1. 全局引入

import xsdDropItems from 'xsd-drop-items'
Vue.use(xsdDropItems)

2.3 使用方法

2.3.1 使用示例

<template>
  <div id="app">
    <xsd-drop-items
      :items="items"
      @choose="choose"
      v-model="selectedItem"
    >
    </xsd-drop-items>
    {{this.selectedItem}}
  </div>
</template>

<script>

import { xsdDropItems } from './components/xsd-drop-items'

export default {
  name: 'App',
  components: {
    [xsdDropItems.name]: xsdDropItems,
  },
  data() {
    return {
      items: [
        { key: 0, value: '刘备' },
        { key: 1, value: '关羽' },
        { key: 2, value: '张飞' },
        { key: 3, value: '赵云' },
      ],
      selectedValue: '',
      selectedItem: {}
    }
  },
  methods: {
    choose(item) {
      this.selectedValue = item.value;
      console.log(this.selectedValue);
    },
  }
}
</script>

2.3.2 两种获取选中项的方法

  1. 使用 v-model 语法糖 (推荐使用)
    1. v-model 绑定的对象会自动更新为 下拉菜单的选中项
  2. 使用 choose 事件(老版本获取选中项的方式,不推荐使用,但保留其用法)
    1. choose 事件绑定的方法的第一个参数的值就是下拉菜单的选中项

2.4 属性和方法

  1. items

    1. items 是用户提供的选项

    2. items 的格式

      1. 是一个数组

      2. 数组元素是对象,这个对象有两个属性

        1. key
        2. value
      3. key 值不可以相同

  2. choose

    1. choose 是点击选项所触发的事件
    2. choose 的参数是用户选择的选项 item, 我们可以从中获取 key 和 value

2.5 样式类

  1. 鼠标悬停样式
   .xsd-drop-item:hover {
       background-color: rgb(161, 208, 255);
   }
  1. 选项样式
   .xsd-drop-item {
       text-align: center;
       height: 22px;
       background-color: #eee;
       border-bottom: 1px solid #ccc;
       border-left: 1px solid #ccc;
       border-right: 1px solid #ccc;
       cursor: pointer;
   }
  1. 组件容器样式(主要用来设置宽度)
   .xsd-drop-container {
       width: 120px;
       position: relative;
   }
  1. 下拉框的样式
.xsd-it {
  position: relative;
  height: 22px;
  background-color: #fff;
  text-align: center;
  border: 1px solid #409eff;
  padding-right: 21px;
  padding-left: 8px;
}