fix(FE): ColorPickerButton.vue rm '#' from returned value

This commit is contained in:
Michael 2025-04-09 10:28:37 +02:00
parent cd7627b3bb
commit ae74a76e0c

View file

@ -1,16 +1,20 @@
<script setup lang="ts">
import {ref} from 'vue';
import {ref, watch} from 'vue';
const localColor = defineModel<string>();
const menu = ref(false)
watch(localColor, (newValue) => {
if (newValue) {
localColor.value = newValue.replace('#', '');
}
});
</script>
<template>
<v-menu offset-x :close-on-content-click="false" v-model="menu">
<template v-slot:activator="{ props }">
<v-btn v-bind="props" :color="localColor">
{{ localColor || 'Seleziona un colore' }}
<v-btn v-bind="props" :color="`#${localColor}`">
{{ `#${localColor}` || 'Seleziona un colore' }}
</v-btn>
</template>
<v-color-picker v-model="localColor" mode="hex"></v-color-picker>