temporarily emulate @update:modelValue

This commit is contained in:
Massedil 2024-06-19 17:26:27 +02:00
parent 04ee634594
commit c237b276ca
2 changed files with 22 additions and 6 deletions

View File

@ -34,7 +34,7 @@
"@apollo/client": "^3.3.16",
"@framasoft/socket": "^1.0.0",
"@framasoft/socket-apollo-link": "^1.0.0",
"@oruga-ui/oruga-next": "^0.8.2",
"@oruga-ui/oruga-next": "0.8.10",
"@oruga-ui/theme-oruga": "^0.2.0",
"@fullcalendar/core": "^6.1.10",
"@fullcalendar/daygrid": "^6.1.10",

View File

@ -1,7 +1,8 @@
<template>
<o-taginput
:modelValue="modelValueWithDisplayName"
@update:modelValue="(val: IActor[]) => $emit('update:modelValue', val)"
@remove="remove"
@add="add"
:data="availableActors"
:allow-autocomplete="true"
:allow-new="false"
@ -25,12 +26,27 @@ import { computed, ref } from "vue";
import ActorInline from "./ActorInline.vue";
import { useI18n } from "vue-i18n";
const props = defineProps<{
modelValue: IActor[];
// TODO It seems that '@update:modelValue="updateTags"' does not works anymore...
// so temporarily call the function updateTags() at remove and add tag event
// https://github.com/oruga-ui/oruga/issues/967
function remove() {
updateTags(modelValueWithDisplayName.value);
}
function add() {
updateTags(modelValueWithDisplayName.value);
}
const emit = defineEmits<{
"update:modelValue": [value: IActor[]];
}>();
defineEmits<{
"update:modelValue": [value: IActor[]];
const updateTags = (val: IActor[]) => {
emit("update:modelValue", val);
};
const props = defineProps<{
modelValue: IActor[];
}>();
const modelValue = computed(() => props.modelValue);