Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

216
Vistas
Calling background image is not working vue.js

I have a template and I need to call a background-image in my scss. Calling this image using a img tag works perfectly fine, but as soon as I try the same in my <style> tags it does not work and find it anymore and gives the error Can't resolve.

I'm using Laravel and Vue, they are all sent to my public folder where my image is correctly located. My image is located in a file called images in the public folder, while my Vue is all going to my App.js which is inside the js folder in public.

What would be the correct way to call an image in Vue? Should I add an assests folder to my JS folder and add the image there?

Thank you for any help in advance. Laravel resources folder

enter image description here

Laravel public folder

enter image description here

<template>
    <div class="hero">
         <!-- works -->
        <img src="images/home/wow.webp" alt="img">
        <div class="hero-left">
            <h1>HI</h1>
        </div>
    </div>
</template>

<script>
export default {
    name: "Hero",
}
</script>

<style lang="scss" scoped>

    .hero {
        height: 90vh;
        width: 100%;
        background-image: url('../images/home/wow.webp'); // Does not work

        img {
            height: 100%;
            width: 100%;
        }
    }

</style>
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You are not using the same path.

images/home/wow.webp is not the same as ../images/home/wow.webp.

Am I missing something?

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda