feat: remove props destructuring from ColorPicker
This commit is contained in:
parent
825d1add49
commit
eb07be1a62
@ -70,13 +70,7 @@ import {computed, ref, watch} from 'vue'
|
|||||||
import {createRandomID} from '@/helpers/randomId'
|
import {createRandomID} from '@/helpers/randomId'
|
||||||
import XButton from '@/components/input/Button.vue'
|
import XButton from '@/components/input/Button.vue'
|
||||||
|
|
||||||
const {
|
const model = defineModel<string>({ required: true })
|
||||||
modelValue,
|
|
||||||
} = defineProps<{
|
|
||||||
modelValue: string,
|
|
||||||
}>()
|
|
||||||
|
|
||||||
const emit = defineEmits(['update:modelValue'])
|
|
||||||
|
|
||||||
const DEFAULT_COLORS = [
|
const DEFAULT_COLORS = [
|
||||||
'#1973ff',
|
'#1973ff',
|
||||||
@ -93,7 +87,7 @@ const defaultColors = ref(DEFAULT_COLORS)
|
|||||||
const colorListID = ref(createRandomID())
|
const colorListID = ref(createRandomID())
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => modelValue,
|
model,
|
||||||
(newValue) => {
|
(newValue) => {
|
||||||
if (newValue === '' || newValue.startsWith('var(')) {
|
if (newValue === '' || newValue.startsWith('var(')) {
|
||||||
color.value = ''
|
color.value = ''
|
||||||
@ -123,7 +117,7 @@ function update(force = false) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
lastChangeTimeout.value = setTimeout(() => {
|
lastChangeTimeout.value = setTimeout(() => {
|
||||||
emit('update:modelValue', color.value)
|
model.value = color.value
|
||||||
}, 500)
|
}, 500)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user