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

fancy-select2

v1.0.2

Published

a vue tree-select component

Downloads

9

Readme

fancy-select

一个基于 vue 的高性能树形选择组件

特点

  • 提供树形结构的单选和多选
  • 子节点懒加载
  • 支持键盘事件
  • 自定义树节点
  • 上万条数据流畅展示

安装

npm 安装

npm install --save fancy-select2

script 引入

<script src="https://unpkg.com/fancy-select2"></script>

使用

npm引入

import组件

import FancySelect from "fancy-select2";

在组件中引入

components: {
  FancySelect;
}

引入样式文件

import "fancy-select2/dist/fancy-select2.min.css";

script标签引入

引入样式文件

<link
  rel="stylesheet"
  href="https://unpkg.com/[email protected]/dist/fancy-select2.min.css"
/>

注册组件

Vue.component("fancy-select2", FancySelect.default);

基本使用

<fancy-select :tree-data="options"></fancy-select>

组件属性

| 参数 | 说明 | 类型 | 可选值 | 默认值 | | ------------------ | ------------------------------------------------------------ | -------- | -------------------------------------- | ------------------------------------------------------------ | | treeData | 原始数据 | Array | | null | | label | 数据中用于展示的字段名称 | String | | label | | multiple | 是否用于多选 | Boolean | true/false | true | | maxHeight | 下拉菜单的最大高度 | Number | | 300 | | matchKeys | 搜索的匹配字段 | 数组 | | ['label'] | | includeValue | 选中树型数据时,可以选择只返回父节点、子节点、、所有节点包括半选状态的节点、所有节点不包括半选状态 | String | PARENT/LEAF/ALL/ALL_WITH_INDETERMINATE | PARENT | | noResultsText | 搜索无匹配数据的提示信息 | String | | 暂无数据 | | loadOptions | 异步加载函数 | Function | | | | noChildrenText | 无子节点提示信息 | String | | 暂无子节点 | | value | 初始值,如果需要双向绑定,则直接使用v-model | Array | | null | | placeholder | placeholder | String | | 请选择数据... | | limit | 限制选中的值的显示个数 | Number | | Infinity | | limitText | 超过limit值后,显示的内容 | Function | | function limitTextDefault(count) {return + ${count}} | | normalizer | 指定数据的id,children,label字段 | Function | | function(node){return{id:node.id,label:node.label,children:node.children}} | | defaultExpandLevel | 默认展开的层级 | Number | | 0 |