Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

164
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!