1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<style lang="scss">
</style>
<template>
<Popover id="lpPickerContainer" :shown="shown" @hide="shown = false">
<span slot="target" class="lpLegend" :style="{'background-color': color}" @click="shown = true" />
<VueColorPicker slot="content" :width="150" :height="150" :disabled="false" :start-color="color" @color-change="onColorChange" />
</Popover>
</template>
<script>
import VueColorPicker from 'vue-color-picker-wheel';
import Popover from './popover.vue';
export default {
name: 'ColorPicker',
components: {
VueColorPicker,
Popover,
},
props: [
'color',
],
data() {
return {
shown: false,
};
},
methods: {
onColorChange(newColor) {
this.$emit('colorChange', newColor);
},
},
};
</script>