R
R
reinmaker902021-01-12 00:36:11
webpack
reinmaker90, 2021-01-12 00:36:11

How to set paths to images correctly?

There is a component:

<b-card
            :title="prod.name"
            :img-src="require(`@/assets/img/${prod.image}`)"
            img-alt="Image"
            img-top
            v-for="prod of PRODUCTS"
            :key="prod.article"
          >
            <b-card-text>

With this approach, pictures are not displayed. As I understand it, the problem is either with webpack, or with vue-loader and its path settings, almost all links with similar questions lead here , but I don’t understand in which file to make changes.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
dicem, 2021-01-12
@reinmaker1990

Move your images folder to /public and access them like<img :src=" '/' + prod.image ">

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question