Menu Close

How to set static image src in Vue.js template with JavaScript?

set static image in Vue.js

In this article, we’ll look at how to set static image src in Vue.js template with JavaScript.

To set static image src in Vue.js template with JavaScript, we set the path relative to the src folder.

For instance, we write

<template>
  <img src="/static/img/clear.gif" />
</template> 

To add an img element with src set to a path relative to the src folder to load the image.

To set static image src in Vue.js template with JavaScript, we set the path relative to the src folder.

Posted in JavaScript, Vue.js

You can also read...