How to preload images using Vue.js?

Sometimes, we want to preload images using Vue.js.

In this article, we’ll look at how to preload images using Vue.js.

How to preload images using Vue.js?

To preload images using Vue.js, we can set the rel attribute of the img element to preload.

For instance, we write

<template>
  <div>
    <img :src="images.secondScreenShot" rel="preload" />
  </div>
</template>

to set the rel attribute to preload to preload the image.

Conclusion

To preload images using Vue.js, we can set the rel attribute of the img element to preload.