项目
在 GitHub 查看
bluzky/nice-select2
关于
轻量级原生 JavaScript 库,可将原生 select 元素替换为可自定义的下拉菜单。
开发工具实测星标增长
- 24小时
- 0
- 7天
- 0
- 15天
- -1
- 1个月
- 正在收集历史
各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。
README.md
原文Nice Select
A lightweight Vanilla JavaScript plugin that replaces native select elements with customizable dropdowns.
Install
npm i nice-select2
Usage
Include nice-select2 script.
<script src="path/to/nice-select2.js"></script>
Include the styles, either the compiled CSS...
<link rel="stylesheet" href="path/to/nice-select2.css" />
Or import nice-select2 using ES6 syntax
import NiceSelect from "nice-select2";
@import "~nice-select2/dist/css/nice-select2.css";
// or
@import "~nice-select2/src/scss/nice-select2.scss";
Finally, initialize the plugin.
Using the minimified file directly:
NiceSelect.bind(document.getElementById("a-select"), {searchable: true, placeholder: 'select', searchtext: 'zoek', selectedtext: 'geselecteerd'});
Using as import in webpack:
new NiceSelect(document.getElementById("a-select"), {searchable: true});
Instance method
update(): update nice-select items to match with source selectfocus(): open dropdown list and focus on the search box if search is enableddisable(): disable selectenable(): enable selectdestroy(): destroy NiceSelect2 instanceclear(): clear all selected options
Full documentation and examples at https://bluzky.github.io/nice-select2/.
探索相关项目
加载中…