New Dec 13, 2025

Fill v-combobox value with an API response

Libraries, Frameworks, etc. All from Newest questions tagged vue.js - Stack Overflow View Fill v-combobox value with an API response on stackoverflow.com

I'm trying to fill a v-combobox values with an array of Object filled by an API call.

I tried to fill this v-combobox with :items=myArrayOfObject but it doesn't work and in my console I see "type check failed for prop "items". Expected Array". I believe that I miss something about array of Object types.

I logged the state of barcodeTypeList and it is filled properly when the component is loaded.

Anyone has a hint ?

here is my code

Component code :

<script setup lang="ts">
import { api } from '../../modules/api'
import type { BarcodeType } from '../../types/barcode-type'
import { ref, onMounted } from 'vue'

const barcodeTypeList = ref<BarcodeType[]>([]) const selectedBarcodeType = ref<BarcodeType | null>(null) const isLoading = ref<boolean>(false)

onMounted(async () => { isLoading.value = true barcodeTypeList.value = await api.getBarcodeTypes() console.log('barcodeTypeList.value : ', barcodeTypeList.value) isLoading.value = false }) </script>

<template> <v-combobox> label="Barcode type" item-title="typeName" item-value="typeIdentifier" density="compact" hide-details="auto" v-model="selectedBarcodeType" :loading="isLoading" :items="barcodeTypeList" ></v-combobox> </template>

API response

{
"barcodeTypeList": [
    {
        "typeName": "Code 128",
        "typeIdentifier": "code128"
    },
    {
        "typeName": "Code 39",
        "typeIdentifier": "code39"
    },
  ]

}

Console.log result of barcodeTypeList.value :

Console.log result of barcodeTypeList.value

Edit 1 : Adding loading state management, changing combobox code to fit with vuetify specs, adding console.log statement to track barcodeTypeList.value state

Scroll to top