Skip to content

UTree value-key not working #3762

Open
Open
@alex-eri

Description

@alex-eri

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtriagev3#1289

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions