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

73
Visualizações
b-link of bootstrap-vue doesn't show textContent or innerHTML

I am unable to get textContent from blink and change it. If I try the same with a tag or div tag, then it works fine.

<b-link
 :ref="index"
 v-b-toggle="`${index}`"
 @click="changeText(index)"
>View More</b-link>

changeText(index) {
 console.log(this.$refs[index][0].textContent); // undefined
}
about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

The difference between a <div /> and <b-link /> is, that the former is an actual native HTML tag while the latter is a component which provides some degree of abstraction. To learn more about that, I recommend reading about native web components and their Vue counterparts.

To change the content of your <b-link /> you have to make use of Vue's reactivity:

let buttonText = 'View More';

<b-link
 :ref="index"
 v-b-toggle="`${index}`"
 @click="changeText(index)"
>{{ buttonText }}</b-link>

changeText(index) {
 console.log(viewMore); // undefined
 viewMore = 'View Less';
}
about 4 years ago · Juan Pablo Isaza Relatório

0

I found out from the vue js test cases how to do this Normally this works

console.log(this.$refs[index][0].textContent);

but as bootstrap-vue will return vue component to access its element we need to use $el to access its properties.

console.log(this.$refs[index][0].$el.textContent);
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