How to bind img src to data in Vue

If you’re using vue-cli you have to remember that everything is processed as a module, even images. You’d need to use require if the path is relative in JS, like this:

{ name: 'test1', src: require("https://stackoverflow.com/questions/48847644/assets/logo.png") }

You can find a lot more details about this here: http://vuejs-templates.github.io/webpack/static.html

Leave a Comment