Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

81
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda