Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

181
Vistas
Typscript: How do I Call Nested Array on Vue Data?

I created an interface with the code below:

export interface ISubcategories {
    subCategoryTopic: string;
    subCategoryImageURL: string;
    subCategoryImage: ISubcategoryImages[];
}

export interface ISubcategoryImages {
    podcastImageURL: string;
    videoImageURL: string;
    articleImageURL: string;
}

export interface ICategories {
    categoryTopic: string;
    subCategory: ISubcategories[];
}

I called it in the data section of my vuejs code with:

categoryData: {
  categoryTopic: "" as string,
  subCategory: [] as Array<ISubcategories>,
},

However, when I do add the code below to the textbox where I want the data to be, I get this error :

_vm.categoryData.subCategory.subCategoryImage is undefined.

What should I do ?

v-model="categoryData.subCategory.subCategoryImage.podcastImageURL"
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

One observation : As subCategory & subCategoryImage in interface ISubcategories is defined as an array. You can not access it's object directly with dot(.) notation. You can access elements via index or by iteration.

For ex :

<div v-for="(subCat, index) in categoryData.subCategory" :key="index">
    <div v-for"(imageUrl, i) in subCat.subCategoryImage" :key="i">
        <input v-model="imageUrl.podcastImageURL"/>
    </div>
</div>
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda