0

I'm trying to insert my image using a b-img tag. (I'm using the bootstrap-vue library) When I do so, all I get is the little image icon.

Here is my code:

<template>
    <div>
        <b-img src="./img/jawnfinder-logo.png"></b-img>
        <b-nav>
            <b-button variant="primary">Sign-Up</b-button>
            <b-button variant="primary">Login</b-button>
        </b-nav>
    </div>
</template>

Here is the folder that the image is in:

enter image description here

And here is what my webpage looks like:

enter image description here

Does anyone have a clue as to why this isn't working?

Ben
  • 117
  • 3
  • 10

3 Answers3

3

move your image inside src/assets then use the image.

<img alt="Vue logo" src="@/assets/jawnfinder-logo.png">

or

<b-img src="@/assets/jawnfinder-logo.png"></b-img>

Note: All the files including components,css and image should be inside src folder.

Kenneth
  • 2,813
  • 3
  • 22
  • 46
0

You can always import as a module if you don't want to deal with paths.

<b-img :src="require('./img/jawnfinder-logo.png')"></b-img>
DedaDev
  • 4,441
  • 2
  • 21
  • 28
0

If you are using Vue-Loader, it won't know that src on <b-img> is a project relative URL. You need to make sure you instruct Vue Loader which props in BootstrapVue are image src props:

https://bootstrap-vue.js.org/docs/reference/images

Troy Morehouse
  • 5,320
  • 1
  • 27
  • 38