我正在使用这个组件https://github.com/vueform/multiselect
<Multiselect :options="testData" label="name"/> const testData = computed(() => {
return [
{ name: 'Vue.js', id: 'vue' },
{ name: 'Angular', id: 'angular' }
]
})
return { testData }标签必须是对象的属性。有没有人知道,是否有可能让标签看起来像1, 2而不是Vue.js, Angular?我希望标签显示为数字。像index + 1一样
发布于 2021-10-30 19:33:51
在阵列上使用map:
...
[...].map((value, index) => {
return {
name: value.name,
id: index+1
}
})
...https://stackoverflow.com/questions/69781219
复制相似问题