0.0.7 • Published 6 years ago

vue-select-item v0.0.7

Weekly downloads
3
License
MIT
Repository
github
Last release
6 years ago

:white_check_mark: Vue Select Item

Vue 2.x component for selecting images from list

Installation

# Yarn
yarn add vue-select-item

# NPM
npm i vue-select-item --save

How to use

Import

import VueSelectItem from 'vue-select-item'
// add stylesheet
require('vue-select-item/dist/vue-select-image.css')

Register components

components: { VueSelectItem }

Register as global component

Vue.use(VueSelectItem)

Sample Array Image

[{
  id: '1',
  src: 'https://unsplash.it/200?random',
  alt: 'Alt Image 1',
  disabled: true // disable element selection and add [disabled] attribute to element; you can customize styles for this case
}, {
  id: '2',
  src: 'https://unsplash.it/200?random',
  alt: 'Alt Image 2'
}]

Template

Single Selection

<vue-select-item :dataImages="dataImages"
                  @onselectimage="onSelectImage">
</vue-select-item>

onselectimage will return emitted with parameter object image selected

Multiple Selection

<vue-select-item :dataImages="dataImages"
                  :is-multiple="true"
                  :selectedImages="initialSelected"
                  @onselectmultipleimage="onSelectMultipleImage">
</vue-select-item>

onselectmultipleimage will return emitted with parameter list of object images selected

Available Props

AttributeTypeDefaultDescription
:dataImagesArray[]Array of images that will be shown
:selectedImagesArray[]Array of initial selected images
:isMultipleBooleanfalseFlag to enable multiple selection
:useCheckMarkBooleanfalseFlag to enable checkmark element
:useLabelBooleanfalseFlag to enable showing alt as label
:rootClassStringvue-select-itemClass for root element of this component
:activeClassString--selectedClass for active state, will concat with :rootClass
:hStringautoHeight of images, ex: '50px'
:wStringautoWidth of images, ex: '50px'

Available Events

Events AttrReturn
@onselectimageObject image selected
@onselectmultipleimageArray of object image has been selected

Credit

Thanks for inspiration : https://github.com/rvera/image-picker

Contributing

If you'd like to contribute, head to the contributing guidelines. Inside you'll find directions for opening issues, coding standards, and notes on development.

Hope will usefull for you all.

created by Irfan Maulana modified by thisninja