Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

127
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda