question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Help: Using images in carousel

See original GitHub issue

How may I use images from my project in img tag of b-carousel-slide? I’m trying to define img=“~@/assets/img/thumbnails/01.jpg”, but it doesn’t works.

<div class="container-fluid">
  <div class="container">

    <b-carousel controls indicators :interval="7000" background="#ABABAB" height="300px">
      <!-- Text slides -->
      <b-carousel-slide height="300px" caption="First slide" text="Nulla vitae elit libero, a pharetra augue mollis interdum." img="~@/assets/img/thumbnails/01.jpg">
      </b-carousel-slide>

    </b-carousel>

  </div>
</div>

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:2
  • Comments:12 (7 by maintainers)

github_iconTop GitHub Comments

3reactions
tmorehousecommented, Sep 17, 2017

I know this is an old issue, but here is a solution. In your vue-loader config options, you need to instruct it to know which props are available to be transformed via the transformToRequire option of vue-loader:

transformToRequire: {
  img: 'src',
  image: 'xlink:href',
  'b-img': 'src',
  'b-img-lazy': ['src', 'blank-src'],
  'b-card': 'img-src',
  'b-card-img': 'img-src',
  'b-carousel-slide': 'img-src',
  'b-embed': 'src'
}

The default for transformToRequire is:

transformToRequire: { img: ‘src’, image: ‘xlink:href’ }


Which is why your images passed to `<carousel-slide>` were not being translated.
1reaction
johnferchercommented, Aug 17, 2017

Is possible resolve this issue? I mean, every place in Vue and Vue-Bootstrap I can use images from assets folder, just in Carousel this happens.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Use Image Carousels the Right Way [2022]? | VWO
Learn how to use image carousels, manual sliders, and hero images place of auto ... here are a few image carousel alternatives you...
Read more >
How to use image carousel - Looking for a little help?
1. On a page, click IMAGE on the media toolbar and select one of the images you would like to add to the...
Read more >
Carousel best practices & images - ClubRunner Support
Best Practices. For the ClubRunner carousel widget, we recommend keeping all photos the same size via their dimensions, height and width.
Read more >
How To Use The Image Carousel Element - YouTube
In this series of videos, we are looking at how to use the Avada Builder Elements. This video looks at how to use...
Read more >
How to Use Instagram Carousels to 10x Engagement [Guide]
An Instagram carousel is a post with up to 10 photos or videos. Mobile Instagram users can view carousel posts by swiping left,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found