K
K
kroha30002020-05-21 10:50:23
css
kroha3000, 2020-05-21 10:50:23

How to embed an image in vue when only the location folder is known. But the name and image format is not known?

How to embed an image in vue when only the location folder is known. But the name and image format is not known? At the same time, we know for sure that the image in the folder is the only one. But we do not know his name, and the format too.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Aetae, 2020-05-22
@Aetae

It will already be there somewhere on the server at the time of execution , or is it still there at the compilation stage ?
If the latter, then it is possible and not difficult, but it depends on the packer you use.
For example, in webpack , you can use require.context to get files in a specific directory.
If the former, then in the general case it is impossible: the client does not know what you have there on the server. The server will have to pass the path to the file to the application in one way or another.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question