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

122
Vistas
how should javascript array control be

there is an array data as below. I will have a nav. operation on the incoming data data in the array, otherwise I will print the data it is, I wonder how can I do this?`

title: item.title,

if item.title in the incoming data nav. If there is Let this.$t(item.title) pass the print check. but if there is no nav. then check if this.$t(item.title)

menu_items: [
        {
          title: 'nav.home',
          path: '/',
          Index: 0
        },
        {
          title: 'nav.gallery',
          path: '/gallery',
          order: 10
        },
        {
          title: 'nav.contact',
          path: '/contact',
          order: 12
        },
        {
          title: 'hello',
          path: '/hello',
          order: 13
        },
        {
          title: 'hello2',
          path: '/hello2',
          order: 14
        }
      ]
menuItem() {
      return this.menu_items.map(item => {
        return {
          title: item.title,
          path: item.path,
          children: item.children,
          order: item.order
        }
      }).sort((a, b) => a.order - b.order)
    }
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

first thing you need to do is search item.title item.title.search('nav.') If there is no nav. in the data after checking, if item.title exists, this.$t(item.title)

menuItem() {
      return this.menu_items.map(item => {
        return {
          title: item.title.search('nav.') ? item.title : this.$t(item.title),
          path: item.path,
          children: item.children,
          order: item.order
        }
      }).sort((a, b) => a.order - b.order)
    }
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