1.0.6 • Published 4 years ago

@duoa/vue-color-picker v1.0.6

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

Vue Color Picker

Color Picker base on Vue2.x

Take a glance

Online Demo

Installation

npm i -S @duoa/vue-color-picker

Usage

Register the component

import Vue from 'vue'
import VueColorPicker from '@duoa/vue-color-picker'
// Because this components has its styles, you must also import the css file.
import '@duoa/vue-color-picker/dist/vue-color-picker.css'

// Register
Vue.use(VueColorPicker)

Declare the component

<template>
  <vue-color-picker v-model="color" />
</template>
<script>
export default {
  data () {
    return {
      color: '#ff00ff'
    }
  }
}
</script>

That's all you need to do!

If you want to customize the component name. Here is an example.

import Vue from 'vue'
import { component } from '@duoa/vue-color-picker'
import '@duoa/vue-color-picker/dist/vue-color-picker.css'

// Register
Vue.component('MyColorPicker', component)

Configuration

NameTypeDefault ValueRequiredDescription
value / v-modelstring''--binding value
colorFormatstringhex (when show-alpha is false)/ rgb (when show-alpha is true)--color format of v-model, hsl / hsv / hex / rgb is accepted
showAlphabooleanfalse--whether to display the alpha slider
disabledbooleanfalse--whether to disable the picker
appendToBodybooleanfalse--whether to append picker popup itself to body. A nested picker popup should have this attribute set to true
predefinearray[]--predefined color options
stopbooleanfalse--stopPropagation when mousedown or click on popup
preventbooleanfalse--preventDefault when mousedown or click on popup

Events

Event NameDescriptionParameters
before-opentriggers before the picker opens--
changetriggers when the selected color changescurrent selected color
closetriggers when the picker closes--
1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago