fix(FE): custom color picker supports vmodel
This commit is contained in:
parent
c20adaa865
commit
2f62ec02cd
1 changed files with 3 additions and 18 deletions
|
@ -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>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue