Skip to content

UInputMenu behaves incorrectly if you specify an int in the value-key #5018

@projct1

Description

@projct1

Environment

Is this bug related to Nuxt or Vue?

Nuxt

Package

v3.x

Version

3.3.4

Reproduction

https://codesandbox.io/p/sandbox/admiring-maria-w8g7j2

Description

I can't pass numbers to value-key, otherwise the v-model value will be an array of objects, and I need an array of IDs (that's why I specify value-key). And when selecting elements further, I'll get a mixed array of objects and IDs:

[ { "id": "10441", "name": "N-Joy community" }, { "id": "10591", "name": "Karaoke Room" }, 10441 ]

And I'll get an error: [Vue warn]: Invalid prop: type check failed for prop "value". Expected String | Object, got Number with value 10441.

It's very inconvenient to cast IDs to strings every time, which requires writing extra code. Especially considering that in 90% of cases, the value-key will be an id (integer).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions