2

I'm having a problem binding data to src attribute in image. This is my code where I have :src and trying to bind image to it. Also I printed this.image in created() and it is getting printed fine. Here is the code

<img class="d-block w-100" :src="image" />

    export default {
      name: 'How',
      data(){
        return{
          image: '../../assets/img/how_to_oka_6.png'
        }
      }
    }

1 Answer 1

4

You should import that image since it considered as a module like :

<img class="d-block w-100" :src="image" />

    export default {
      name: 'How',
      data(){
        return{
          image: require('../../assets/img/how_to_oka_6.png')
        }
      }
    }
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.