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

169
Vistas
How to create an image programmatically and display it in VueJS?

I want to create an image in VueJS with data which I receive from the server. This data includes the title of the image, the type of the image (e.g. image/png) and the content of an image (which is a gibberish string).

I tried to create a method which returns a new File like so:

methods: {
    getFile(img: { content: any; title: string; type: any }): File {
      return new File([img.content], img.title, {
        type: img.type,
      });
    },
  },

And then I tried to bind the created method to the img tag like so:

<template>
  <div>
    <img :src="getFile(image)" />
  </div>
</template>

Where image is an object of type {title: string; type: string; content: string;}.

Unfortunately I receive the following error:

Invalid prop: type check failed for prop "src". Expected String, Object, got File

How can I create an image file and bind it to the View to display it?

Thanks for any help!

about 4 years ago · Juan Pablo Isaza
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