Skip to content

Commit 910f12c

Browse files
committed
feat: add color-copy event
Add a new event `copy-color` that is fired once a copy operation succeeded. Its event data is the same as that of the `color-change` event.
1 parent 7935126 commit 910f12c

File tree

5 files changed

+131
-76
lines changed

5 files changed

+131
-76
lines changed

README.md

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,14 +183,37 @@ You can also register the component and import the styles globally.
183183
<template>
184184
<ColorPicker
185185
color="hsl(270 100% 50% / 0.8)"
186-
@color-change="updateColor"
186+
@color-change="colorChanged"
187187
/>
188188
</template>
189189

190190
<script setup>
191191
import { ColorPicker } from 'vue-accessible-color-picker'
192192

193-
function updateColor (eventData) {
193+
function colorChanged (eventData) {
194+
console.log(eventData)
195+
}
196+
</script>
197+
```
198+
199+
#### `color-copy`
200+
201+
- **Description**: The `color-copy` event is fired once a copy operation succeeded.
202+
- **Data**: Emits the same event data as [the `color-change` event](#color-change).
203+
- **Usage**:
204+
205+
```vue
206+
<template>
207+
<ColorPicker
208+
color="hsl(270 100% 50% / 0.8)"
209+
@color-copy="colorCopied"
210+
/>
211+
</template>
212+
213+
<script setup>
214+
import { ColorPicker } from 'vue-accessible-color-picker'
215+
216+
function colorCopied (eventData) {
194217
console.log(eventData)
195218
}
196219
</script>

dist/ColorPicker.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@ import { PublicProps } from 'vue';
66

77
declare const __VLS_component: DefineComponent<ColorPickerProps, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {} & {
88
"color-change": (data: ColorChangeDetail) => any;
9+
"color-copy": (data: ColorChangeDetail) => any;
910
}, string, PublicProps, Readonly<ColorPickerProps> & Readonly<{
1011
"onColor-change"?: ((data: ColorChangeDetail) => any) | undefined;
12+
"onColor-copy"?: ((data: ColorChangeDetail) => any) | undefined;
1113
}>, {
1214
id: string;
1315
color: string | ColorHsl | ColorHwb | ColorRgb;

0 commit comments

Comments
 (0)