Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

USelect with multiple prop does not trigger event when model-value change #2953

Open
germsb opened this issue Dec 22, 2024 · 1 comment
Open
Labels
bug Something isn't working triage v3 #1289

Comments

@germsb
Copy link

germsb commented Dec 22, 2024

Environment

Operating System: Linux

Is this bug related to Nuxt or Vue?

Nuxt

Version

v3.0.0-alpha.10

Reproduction

//dont work
<USelect variant="none" class="w-full" label-key="name" value-key="id" multiple
    @update:model-value="testFunctionArray" @change="testFunctionArray"
    v-model="row.original.permissionsModel" :items="permissions">
</USelect>
//work fine
<USelect variant="none" class="w-full" label-key="name" value-key="id"
    @update:model-value="testFunction" @change="testFunction"
    v-model="row.original.permissionModel" :items="permissions">
</USelect>

Description

testFunctionArray is never called if multiple prop is set to true

Additional context

No response

Logs

@germsb germsb added bug Something isn't working triage v3 #1289 labels Dec 22, 2024
@germsb
Copy link
Author

germsb commented Dec 23, 2024

after checking in basic usage, this code works as expected:
<USelect v-model="maref" :items="permissions" label-key="name" value-key="id" multiple @update:model-value="(e) => test(e)"></USelect>

but when I use it in a table, it doesn't work anymore

<UTable :data="users" :columns="columns" sticky class="flex-1">
    
<template #permissions-cell="{ row }">
        <div class="min-w-60 rounded-lg" :class="[{ 'bg-pink-300': row.original.permissionsChanged }]">
            <USelect variant="none" class="w-full" label-key="name" value-key="id" multiple
                @update:model-value="(e) => { row.original.permissionsChanged = comparePermissions(e, row.original.permissions) }"
                v-model="row.original.permissionsModel" :items="permissions"></USelect>
        </div>
</template>
    
<template #defaulPermissions-cell="{ row }">
        <div class=" rounded-lg w-50"
            :class="[{ 'outline-2 outline-primary/50': row.original.defaulPermissionsChanged }]">
            <USelect variant="none" class="w-full" label-key="name" value-key="id"
                @update:model-value="(e) => { row.original.defaulPermissionsChanged = row.original.defaulPermissions !== e }"
                v-model="row.original.defaulPermissionsModel" :items="computed(() =>
                    permissions.filter(v => row.original.permissionsModel.some(h => v.id === h))
                ).value">
            </USelect>
        </div>
    </template>


    <template #userModify-cell="{ row }">
        <UButton v-if="row.original.defaulPermissionsChanged || row.original.permissionsChanged"
            variant="outline" @click="modifyPermissions(row.original)"> confirmer

        </UButton>
    </template>
</UTable>

row.original.permissionsModel is well updated but the events are not triggered

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triage v3 #1289
Projects
None yet
Development

No branches or pull requests

1 participant