Tutorialsplane

Vue.js Display image


Vue.js Display image We can use v-bind:src=”” to display image in vue.js. We can also use :src=”” shorthand to show image in vuejs. Here in this article we are going to explain how you can display image in vuejs. You can also use our online editor to edit and run the code online.


Vue.js Display image Example

Here is simple example to –

Example:

<div id="app">	
	<p v-if="myImage.length > 0"></p>
	<button>Show Image</button>
</div>

Try it »

In the above example we have create myFucntion to assign image src to variable myImage. When you click on the show image button it will update the variable and display image.

Output of above example-