Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

undeportedmexican's avatar

Correct way to add images in Vue?

Hello people!

Just wondering the correct way to include images and icons into Vue. I'm currently doing it like this, but I don't get any autocomplete from PHPStorm at all, so not sure if there's a better help, or a helper, or something?

<img
       src="/Identity/Logotipo/logo_gray.png"
       alt="Logo"
       class="w-64 hidden md:block"
>
                	
0 likes
6 replies
vincent15000's avatar

No matter if it is with VueJS or another framework, the way to display an image is the same : HTML img tag.

undeportedmexican's avatar

@vincent15000 Yeah, I guess I phrased my question incorrectly.

What I meant is, in Laravel you use the asset() helper, which promptly offers you autocomplete and suggestions based on your assets.

What I meant to ask is if there's something similar in Vue

xdimension's avatar

@undeportedmexican I don't think there's any function like asset() on client side, but you can send it (the image url from asset()) from server side.

1 like
undeportedmexican's avatar

@vincent15000 well... they all mainly come from the public root.. so not sure about a base_path variable. Also, I'm mainly more interested in the autocomplete features from PHP storm.

Please or to participate in this conversation.