Attribute":SRC" not working in Vue?

Asked

Viewed 145 times

0

Hello I would like to understand pq the ":SRC" is not working in Vue js, I tried to render an image that has its path inside the property "img", but simply does not work.

picture tag:

<img :src="img" />

property:

data: () => ({
    img: '../assets/imgs/teste.png'    
})

,

Observing: the path is correct, and when I put this path in the static SRC property it works like this:

<img src="../assets/imgs/teste.png" />

Can anyone tell me what’s wrong?

  • how does it work? img: require('.. /Assets/imgs/test.png')

1 answer

1


Browser other questions tagged

You are not signed in. Login or sign up in order to post.