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

140
Visualizações
How to render a map of maps in vue

I created a map of maps like below:

{year1:{topic1:[article1,article2]},year2:{topic1:{article3}}}

I tried to use v-for to iterate this map but failed.

When I print in the template I see the following:

{ "Map(1)": { "2016 =>": { "Map(2)": { "Conference =>": [1], "Journal =>": [ 2, 3 ] } } } }

I use the following code to generate this map:

            var result = new Map()
            for (var t in temparray){
                var object = this.papers[temparray[t]]
                var year = object.year
                var tt = object.type
                if (result.get(year) ==undefined){
                    var a = new Map()
                    a.set(tt,[temparray[t]])
                    result.set(year, a)
                }
                else{
                    var inner = result.get(year)
                    if (!inner.has(tt)){
                        inner.set(tt,[temparray[t]])
                    }
                    else{
                        inner.get(tt).push(temparray[t])
                        
                    }
                }
            }
            this.selectedPapers = result

I expect the map to be something like this:

{"2016":{"Conference":[1]}} 
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

I figured it out. to loop a map, I must use [key, value] instead of (key, value). I couldn't find any documentation for that but it solved my issue.

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