vueform / multiselect

Vue 3 multiselect component with single select, multiselect and tagging options (+Tailwind CSS support).
https://vueform.com
MIT License
807 stars 150 forks source link

Array index as value prop #319

Closed erwinyusrizal closed 1 year ago

erwinyusrizal commented 1 year ago

Hi, is there any option to use Array index as the option value?

data=['foo', 'bar', 'john', 'doe']

I would like to use data index as the select option value which is started from 0 and the array value ('foo', 'bar', 'john', 'doe') as the option label

currently it's only support array object with prop value and label

Thanks

adamberecz commented 1 year ago

This is the quickest:

let data = ['foo', 'bar', 'john', 'doe'].map((label, i) => ({ value: i, label }))