Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

745
Views
¿Cómo pasar img src en vue.js usando accesorios?

Tengo un componente info-card.vue que se usa dos veces en una página de destino, pero quiero que se muestren datos diferentes en cada uno de ellos. Aquí está el componente info-card.vue :

 <template> <div class="card-container glass-effect"> <div class="illustration-container"> <img src="{{ image }}" alt="Businesses" class="illustration"> </div> <div class="title-container">{{ title }}</div> <div class="paragraph-container">{{ content }}</div> </div> </template> <script> export default { props: ['image','title', 'content'] } </script>

Y aquí está la página landing-info.vue en la que se usa el componente info-card :

 <div class="business-side"> <info-card image="/images/image1.png" title="BUSINESSES" content="This is some content"></info-card> </div> <div class="customer-side"> <info-card image="/images/image2.png" title="CUSTOMERS" content="This is some content"></info-card> </div>

Pero esto no funcionó, soy nuevo en vue, ¿alguna idea?

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

No puede usar el bigote {{ }} en los atributos de vue. En su lugar, utilice v-bind:attr="" o :attr="" donde attr es el atributo dinámico que desea vincular.

Entonces, su componente de imagen debería ser:

 <img v-bind:src="image" alt="Businesses" class="illustration" />

o

 <img :src="image" alt="Businesses" class="illustration">

Los dos puntos son una abreviatura de v-bind. Lea más sobre v-bind aquí .

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!