0

I have a Vue3 SPA that generates dashbaords and such. When I visit https://website.com/#/ it loads my app. I want to visit https://website.com/#/dynamic-img and have the response be a image/png media type with image data.

I want to create a route like this:

{ path: '/dynamic-img', component: () => import('components/DrawChart'), name: 'DrawChart' },

And when that component renders, it returns an image/png media type to client, that is the image.

Can this be done using vuejs? I understand there are ways to handle web page scraping to gather the images, but I'd like to do it directly from vue.

3
  • Can you clarify how do you expect it to work? If you need to generate a png then do this inside DrawChart. This is not related to a router Commented Jan 31 at 20:40
  • I edited the question. I want to response to the client from the vue app to be an image type. Commented Jan 31 at 21:57
  • This is not possible and needs to be solved from server side. You could do location.href = "data:image/png;base64... at some point but some browsers don't support this, specifically any chrome-based. Consider explaining the purpose, it could be XY problem Commented Jan 31 at 22:19

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.