P
P
ProGra2021-07-02 14:19:42
Vue.js
ProGra, 2021-07-02 14:19:42

How to dynamically add link to images in single file vue components?

When you add a link to an image dynamically, the image itself does not appear in the single-file component. The image path is correct, using VS Code it displays images. Although if the same is done globally, then the images are displayed on the site. But when you do this in a separate component file, the image itself does not show, although everything looks ok. There are no errors in the console, what could be the problem here?
60def3f09e093500037411.png60def3f867484853597985.png60def5feb6b80158578525.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Aetae, 2021-07-02
@ProGra

..//- this is addiction, change to ../.
But that's not the problem. Vue is smart and for string img srcimplicitly does require.
If you want to use a variable, then you have to explicitly add: . loading: require('../../bla/bla.png')

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question