0.1.1 • Published 5 years ago

more-select v0.1.1

Weekly downloads
4
License
MIT
Repository
github
Last release
5 years ago

More Select

npm version Vue Licence

Description

More Select, a vue component, can split steps to load options. Can used in iView, Element to emit Form events, also the events and style can be customized.

More Select拥有分步加载传入Options的功能,滚动触底触发。可以避免一次性渲染所有Options造成浏览器的响应卡顿。用于iView或Element的Form组件中时,可以触发Form事件从而实现校验。同时可以自定义更多事件和显示样式。

Demo

demo

Installation

npm i more-select -S

Usage

Global register

import MoreSelect from 'more-select'
import 'more-select/dist/more-select.css'
Vue.use(MoreSelect)

In singgle component

import { MoreSelect, MoreOption } from 'more-select'
import 'more-select/dist/more-select.css'
export default {
  components: { MoreSelect, MoreOption }
}

example

<more-select
  v-model="user"
  multiple
  filterable
  clearable
  allow-create
  :load-more="20"
  style="width: 600px;"
  >
    <more-option
      v-for="(item, index) in districts"
      :key="index"
      :value="item"
      >
        {{ item }}
    </more-option>
</more-select>

Select Props

propdescriptiontypedefaultrequired
valueThe value of the selected item. Use v-model to enable a two-way binding. It only accepts String or Number in single-choice mode. And it only accepts Array in mutli-choices mode.String | Number | Array""true
multipleSet select to support multipleBooleanfalsefalse
disabledSet select to disableBooleanfalsefalse
clearableSet select to clear option where used in single modeBooleanfalsefalse
filterableSet select to support filterBooleanfalsefalse
load-moreSet select to support loadmore. Number type is to set options limit number, default limit is 50Boolean | Number""false
sizeThe size of select. The value could be large, small, default or none.Stringdefaultfalse
placeholderThe text for placeholderString""false
autocompleteThe autocomplete attribute of select inputString""false
allow-createWhether creating new items is allowed. filterable must be trueString""false
eventsThe events are emitted when value changed. Array item format must be {componentName: 'dispatch component name', event: 'event name'}Array--false
not-found-textThe text to show when the select is nullString""false
popper-classAdd class name to dropdown listString--false
load-more-classAdd class name to loadmore loading itemString--false

Select Events

namedescriptionparams
on-changeEmitted when selected Option changed. It will return value.current selected item
on-query-changeEmitted when query word is changed.query
on-clearEmitted when click clear icon.--
on-open-changeEmitted when dropdown show or hide.true / false

Select Slot

namedescription
loadmoreCustom loadmore item content

Option Props

propdescriptiontypedefaultrequired
valueThe option value, filter by the propertyString | Number--true
labelThe content of the option, read slot default.String--false
disabledSet to disable the option.Booleanfalsefalse

License

MIT