fix(FE): custom color picker supports vmodel

This commit is contained in:
Michael 2025-03-30 23:37:11 +02:00
parent c20adaa865
commit 2f62ec02cd

View file

@ -1,31 +1,16 @@
<script setup lang="ts">
import {watch, ref} from 'vue';
import {ref} from 'vue';
const emit = defineEmits([
'color-selected'
])
const localColor = defineModel<string>();
const props = defineProps({
color: {
default: '',
type: String
}
})
const localColor = ref(props.color)
const menu = ref(false)
const saveColor = (color: string) => {
menu.value = false;
emit('color-selected', color);
}
</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 || 'Select Color' }}
{{ localColor || 'Seleziona un colore' }}
</v-btn>
</template>
<v-color-picker v-model="localColor" mode="hex"></v-color-picker>