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

121
Visualizações
How to display the getter as text in the template

I have a getter, which I would like to display in the template as text.

The data is already in the getter, checked with devtools vue chrome extension. The data I want to get from the getter looks like this:

["appel", "banaan", "kiwi"]

My component looks like this: (the name of getter is getPlaylist)

<template>
    <div>
      <span>{{ showPlaylist }}</span>
    </div>
<template>

<script>
import { mapGetters } from "vuex";

export default {
  data() {
    return {
    };
  },
  computed: {
    ...mapGetters("app"["getPlaylist"]),

     showPlaylist() {
       this.getPlaylist;
     },
  },
};
</script>

How can I use this getter to show the text of the array?

Thanks in advance!

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Not sure what you're hoping to get with ...mapGetters("app"["getPlaylist"]), but I can't see it doing anything else other than being an undefined

"app" is a string, which doesn't behave like an object or array. the only thing available that could be accessed is string methods (ie "app"["startsWith"]("a")) or characters "app"[2])

if app is a module and getPlaylist the getter, you need to define it as:

computed: {
  ...mapGetters(["app/getPlaylist"]),
}

alternatively if app is another getter...

computed: {
  ...mapGetters(["app","getPlaylist"]),
}

or if app is a namespace

computed: {
  ...mapGetters("app",["getPlaylist"]),
}
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