I
I
Ilya Tereshchenko2018-05-11 22:16:27
JavaScript
Ilya Tereshchenko, 2018-05-11 22:16:27

Why doesn't nuxt.js find the image in the same path?

With this code everything works fine:

<img src="~/assets/img/recipes_lvl1.png" alt="Нет фото">

while doing this it gives an error:
<img :src="String(recipe.image)" alt="Нет фото">
{ statusCode: 404,
  path: '/recipes/~/assets/img/recipes_lvl1.png',
  message: 'This page could not be found' }

I get the image path from the database and it is exactly the same as the image. But when I write :src it looks for some reason in the URL "recipes". Can this be fixed somehow?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ilya Tereshchenko, 2018-05-11
@inFernal123

I have no idea why nuxt puts the wrong path. But I solved the problem by moving the img folder from assets to the static folder and changing the path to the image to "img/recipes_lvl1.png"

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question