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

UTree value-key not working #3762

Open
alex-eri opened this issue Apr 1, 2025 · 0 comments
Open

UTree value-key not working #3762

alex-eri opened this issue Apr 1, 2025 · 0 comments
Labels
bug Something isn't working triage v3 #1289

Comments

@alex-eri
Copy link

alex-eri commented Apr 1, 2025

Environment



Is this bug related to Nuxt or Vue?

Nuxt

Version

v3.0.2

Reproduction

<template>
  <div class="flex flex-col items-center justify-center gap-4 h-screen">

    {{ state }}

    <div class="flex items-center gap-2">
      <UTree
        :items="gates"
        label-key="label"
        value-key="id"
        v-model="state.gate" 
      >
      </UTree>
    </div>
  </div>
</template>



<script
  lang="ts"
  setup
>

import type { FormSubmitEvent } from '@nuxt/ui'

interface Gate {
  id: number,
  label: string,
  uname: string
}

type Schema = {
  gate: Gate
}

const state = reactive<Partial<Schema>>({
  gate: undefined,
})

const gates = [{id:0, uname: null, label: "unknown"}, {id:1, uname: "first-gate", label: "First"}]

</script>

Description

value-key points to id or missed.

v-model type check points to id:number but there is full object.

Additional context

How to get full object here when bug fixed?

Logs

@alex-eri alex-eri added bug Something isn't working triage v3 #1289 labels Apr 1, 2025
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