Fix no color selected in the color picket

This commit is contained in:
kolaente 2021-01-23 18:41:13 +01:00
parent d1a2eefca6
commit a4fb3e19be
No known key found for this signature in database
GPG key ID: F40E70337AB24C9B

View file

@ -15,7 +15,9 @@
:rgbSliders="true" :rgbSliders="true"
model="hex" model="hex"
picker="square" picker="square"
v-model="color"/> v-model="color"
:class="{'is-empty': empty}"
/>
<x-button @click="reset" class="is-small ml-2" :shadow="false" type="secondary"> <x-button @click="reset" class="is-small ml-2" :shadow="false" type="secondary">
Reset Color Reset Color
</x-button> </x-button>
@ -57,9 +59,18 @@ export default {
mounted() { mounted() {
this.color = this.value this.color = this.value
}, },
computed: {
empty() {
return this.color === '#000000' || this.color === ''
},
},
methods: { methods: {
update() { update() {
if(this.empty) {
return
}
if (this.lastChangeTimeout !== null) { if (this.lastChangeTimeout !== null) {
clearTimeout(this.lastChangeTimeout) clearTimeout(this.lastChangeTimeout)
} }
@ -78,3 +89,15 @@ export default {
}, },
} }
</script> </script>
<style lang="scss">
.verte.is-empty {
.verte__icon {
opacity: 0;
}
.verte__guide {
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAGklEQVQYlWM4c+bMf3TMgA0MBYWDzDkUKQQAlHCpV9ycHeMAAAAASUVORK5CYII=);
}
}
</style>