stijlbreuk-dev / vue-color-picker-wheel Goto Github PK
View Code? Open in Web Editor NEWA Vue color picker component based on the Farbtastic jQuery Color Picker plug-in
License: MIT License
A Vue color picker component based on the Farbtastic jQuery Color Picker plug-in
License: MIT License
colorChange should emit "color-change", otherwise it's impossible to catch the event in dom templates. Thanks!
I tried to use color-change
event listener and I don't see the color value:
<template>
<ColorPicker
:color-change="setHex"
:startColor="finalSettings.button_color"
v-model="finalSettings.button_color" />
</template>
<script>
import ColorPicker from 'vue-color-picker-wheel';
export default {
components: {
ColorPicker,
},
props: {
...
},
data: function () {
return {
finalSettings: this.settings,
color: this.settings.button_color,
}
},
methods: {
setHex: function(colorPalette) {
console.log(colorPalette); // <- the console didn't display this.
this.color = colorPalette;
},
}
}
</script>
I found that the color picker was not following my mouse clicks correctly. I tracked the problem down to widgetCoords(event), which was returning incorrect co-ordinates when the browser window was scrolled away from the start position.
Suggested solution: replace all instances of pageX and pageY with clientX and clientY.
Add support for v-model by using 'value' as a prop and by using '$emit('input')' when changes have occured.
Add property to delay the color change event from triggering using a debounce function or 'onmouseup'
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.