fix(color picker): when picking a color, the color picker should not be black afterwards
This commit is contained in:
parent
b8c21c2ade
commit
c7b70844c6
@ -64,6 +64,15 @@ const emit = defineEmits(['update:modelValue'])
|
|||||||
watch(
|
watch(
|
||||||
() => modelValue,
|
() => modelValue,
|
||||||
(newValue) => {
|
(newValue) => {
|
||||||
|
if (newValue === '' || newValue.startsWith('var(')) {
|
||||||
|
color.value = ''
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!newValue.startsWith('#') && (newValue.length === 6 || newValue.length === 3)) {
|
||||||
|
newValue = `#${newValue}`
|
||||||
|
}
|
||||||
|
|
||||||
color.value = newValue
|
color.value = newValue
|
||||||
},
|
},
|
||||||
{immediate: true},
|
{immediate: true},
|
||||||
|
@ -24,7 +24,7 @@ export default class LabelModel extends AbstractModel<ILabel> implements ILabel
|
|||||||
super()
|
super()
|
||||||
this.assignData(data)
|
this.assignData(data)
|
||||||
|
|
||||||
if (this.hexColor !== '' && this.hexColor.substring(0, 1) !== '#') {
|
if (this.hexColor !== '' && !this.hexColor.startsWith('#') && !this.hexColor.startsWith('var(')) {
|
||||||
this.hexColor = '#' + this.hexColor
|
this.hexColor = '#' + this.hexColor
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user