S
S
SPART4K632021-07-07 12:48:29
Vue.js
SPART4K63, 2021-07-07 12:48:29

How to make correct software navigation on NUXT?

Good afternoon, tell me please.
Let's say I have a catalog with products, each product has its own id in json.
When I click on a product, I go to the product card, where I have a specific path to it. (Let's say the url has become app/catalog/1, etc.)
And I need the ability to go to this product card not only from the catalog (So that if I enter app/catalog/1, the product card opens).
Tell me how to do it more competently, there is an option through router.push, but as far as I understand, I will not be able to go to this card outside the page where such a method is declared.
Thank you in advance!)

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
RokeAlvo, 2021-07-07
@RokeAlvo

in any template > will lead to the transition to the desired route

O
Oleg Kirillov, 2021-07-07
@exmach

You will be able to access it from anywhere on the site.
1. nuxt-link or router.push to app/catalog/id from anywhere.
2. in hooks, for example, asyncData, is taken from the id url and a request is sent to the back to get the data of this catalog element.
3. profit.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question