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

164
Visualizações
Get Object Value by Dynamic key in Vue js

I have this typescript data in a config file:

const filtersTracking = {
  [SEARCH_TYPE_ARTICLES]: {
    orderBy: {
        category: 'Suche Filter Rechtstipps',
        action: 'Sortierung Auswahl',
    },
    practiceAreas: {
      category: 'Suche Filter Rechtstipps',
      action: 'Rechtsgebiet Auswahl',
    },
    ratingAverage: {
      category: 'Suche Filter Rechtstipps',
      action: 'Bewertung Sterne',
    },
    ratingCount: {
      category: 'Suche Filter Rechtstipps',
      action: 'Anzahl Bewertungen',
    },
    publicationYear: {
      category: 'Suche Filter Rechtstipps',
      action: 'Publikation',
    },
    isGuide: {
      category: 'Suche Filter Rechtstipps',
      action: 'Ratgeber',
    },
    hasVideo: {
      category: 'Suche Filter Rechtstipps',
      action: 'Video',
    },
    internationalLaws: {
      category: 'Suche Filter Rechtstipps',
      action: 'Internationales Recht',
    },
  },
}

what I am trying to do is to get 'category' and 'action' data, I have tried following methods but none worked for me:

  1. filtersTracking[SEARCH_TYPE_ARTICLES][key]
  2. filtersTracking[SEARCH_TYPE_ARTICLES].key
  3. filtersTracking[SEARCH_TYPE_ARTICLES].[key]

here 'key' is a dynamic variable and I am getting the data key(e.g 'orderBy' or 'practiceArea') inside 'key'.

public function(key) {
console.log(filtersTracking[SEARCH_TYPE_ARTICLES][key])
}
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

According to your comment BTL, export const SEARCH_TYPE_USERS = 'users'; error message : Element implicitly has an 'any' type because expression of type 'string | number' can't be used to index type

This post should help you:

Element implicitly has an 'any' type because expression of type 'string' can't be used to inde

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