close

How to reference static assets within vue javascript

Hello Guys, How are you all? Hope You all Are Fine. Today we are going to learn How to reference static assets within vue javascript in javascript. So Here I am Explain to you all the possible methods here.

Without wasting your time, Let’s start This Article.

How to reference static assets within vue javascript

  1. How to reference static assets within vue javascript

    to reference static assets within vue javascript Right after oppening script tag just add import someImage from '../assets/someImage.png' and use it for an icon url iconUrl: someImage

  2. How to reference static assets within vue javascript

    to reference static assets within vue javascript Right after oppening script tag just add import someImage from '../assets/someImage.png' and use it for an icon url iconUrl: someImage

Method 1

For anyone looking to refer images from template, You can refer images directly using ‘@’

Example:

<img src="@/assets/images/home.png"/>

Method 2

Right after oppening script tag just add import someImage from '../assets/someImage.png' and use it for an icon url iconUrl: someImage

Summery

It’s all About this article. Hope all method helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which method worked for you? Thank You.

Leave a Comment