Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

215
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda