This commit is contained in:
lyswhut
2023-02-01 16:50:13 +08:00
parent ef7033cac0
commit fdd19068a8
3 changed files with 5 additions and 6 deletions
+3 -4
View File
@@ -4,7 +4,7 @@ import '@simonwep/pickr/dist/themes/classic.min.css'
export interface PickrTools {
pickr: Pickr | null
create: (dom: HTMLElement, color: string, swatches: string[] | null, change: (color: string) => void, reset: () => void) => PickrTools
create: (dom: HTMLElement, color: string, swatches: string[] | null, change: (color: string) => void, reset?: () => void) => PickrTools
destroy: () => void
setColor: (color: string) => void
}
@@ -72,10 +72,9 @@ export const pickrTools: PickrTools = {
pickrTools.pickr.on('swatchselect', (color: any) => {
swatchselectColor = color
}).on('change', throttleChange).on('cancel', () => {
change(color)
console.log('cancel')
}).on('cancel', () => {
reset()
change(color)
reset?.()
})
return pickrTools