# NPM
npm install vue-select-image
# Yarn
yarn add vue-select-image
import VueSelectImage from 'vue-select-image'
Vue.use(VueSelectImage)
// add stylesheet
require('vue-select-image/dist/vue-select-image.css')
<!-- SINGLE SELECTION -->
<vue-select-image :dataImages="dataImages"
@onselectimage="onSelectImage">
</vue-select-image>
<!-- MULTIPLE SELECTION -->
<vue-select-image :dataImages="dataImages"
:is-multiple="true"
:selectedImages="initialSelected"
@onselectmultipleimage="onSelectMultipleImage">
</vue-select-image>
Attribute | Type | Default | Description |
---|---|---|---|
:dataImages | Array | [] | Array of images that will be shown |
:selectedImages | Array | [] | Array of initial selected images |
:isMultiple | Boolean | false | Flag to enable multiple selection |
:useLabel | Boolean | false | Flag to enable showing alt as label |
:rootClass | String | vue-select-image | Class for root element of this component |
:activeClass | String | --selected | Class for active state, will concat with :rootClass |
:h | String | auto | Height of images, ex: '50px' |
:w | String | auto | Width of images, ex: '50px' |
:limit | Number | 0 | To set maximum images can be select |
Events Attr | Return |
---|---|
@onselectimage | Object image selected |
@onselectmultipleimage | Array of object image has been selected |
@onreachlimit | When the length of selected images reach the limit |
Feel free to fork on GitHub if you have any features or bugs !
Copyright © 2017 Irfan Maulana, All Rights Reserved.