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

122
Visualizações
How to load a static content in index.html

I was using vue-cli with webpack for my project and was loading an image in index.html like this // index.html

<html>
    ...
    <style>
        .tag1 { background-image: url('<%= require('@/assets/icons/a123.svg') %>'); }
    </style>
    ...
</html>

how to load the icon in vite based index.html file? I tried url(/assets/icons/a123.svg) but its throwing 404

about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

You can create function, check vite docs

const useImage = ((url) => {
  return new URL(`/src/${url}`, import.meta.url).href;
});

and create global property in main.js:

app.config.globalProperties.$image = useImage;

then use it like:

$image(imageUrl)
about 4 years ago · Juan Pablo Isaza Relatório

0

Move the svg file to /public folder and then u can access it like <img src="/a123.svg" />

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