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

Select Menu does not display array of numbers or booleans #574

Closed
DeHerro1 opened this issue Aug 25, 2023 · 1 comment
Closed

Select Menu does not display array of numbers or booleans #574

DeHerro1 opened this issue Aug 25, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@DeHerro1
Copy link

I tried the below code with an array of numbers and it is not displaying it but I am able to select it.

const numbers = [1, 2, 3, 4, 5, 6, 7, 8];

@DeHerro1 DeHerro1 added the bug Something isn't working label Aug 25, 2023
@eduayme
Copy link
Contributor

eduayme commented Aug 25, 2023

Looks like the SelectMenu component only admits string values. You can always transform all elements from the array using map javascript function before using it in the component. Here an example:

<script setup>
const numbers = [1, 2, 3, 4, 5, 6, 7, 8]

const elements = computed(() => {
  return numbers.map((n) => n.toString());
});
</script>

<template>
  <USelectMenu :options="elements" />
</template>

Haythamasalama pushed a commit to Haythamasalama/ui that referenced this issue Sep 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants