Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/onewaytech/vue-select2-component

Select2 encapsulation for Vue 1.x
https://github.com/onewaytech/vue-select2-component

select2 vue

Last synced: 3 days ago
JSON representation

Select2 encapsulation for Vue 1.x

Awesome Lists containing this project

README

        

# Vue Select2 Component

[![npm version][npm-v-img]][npm-url]
[![npm download][npm-dl-img]][npm-url]

> Intellectual property of [Oneway.mobi](http://www.oneway.mobi/)

#### Requirement

* Vue 1.x
* jQuery ( available globally )
* [Select2](https://github.com/select2/select2)

#### Installation

`npm i vue-select2-component -S`

> alternatively: ``
> which exposes **`VueSelect2`** as a global variable

#### Example
See [here](https://onewaytech.github.io/vue-select2-component/example.html), source in [`example.html`](./example.html)
> I prefer inspecting it with [devtools](https://github.com/vuejs/vue-devtools)

#### Configuration

* `@prop {String/String[]} model (.sync!)`, defaults to `''`
* `@prop {String} models (.sync!)`, defaults to `''`
* `@prop {Object[]} options (required!)`, **must** in `[{ value: {String/Number}, text: {String} }]` pattern
* `@prop {Object} config`, defaults to `{}`. Besides the [basic configuration](http://select2.github.io/options.html) of Select2, we have some extra settings:
* `multiple`: defaults to `undefined` ( Meaning default as a single select )
* `width`: defaults to `100%`
* `delimiter`: defaults to `,` ( Only for multiple select )
* `showValInText`: defaults to `undefined`. If set to `true`, the render result would be:
```

(1) Apple
(2) Banana
...

```

#### Build

`npm run build`

[npm-url]: https://www.npmjs.com/package/vue-select2-component
[npm-v-img]: http://img.shields.io/npm/v/vue-select2-component.svg
[npm-dl-img]: http://img.shields.io/npm/dm/vue-select2-component.svg