A
A
Andrey Sobolev2020-11-25 15:44:06
Vue.js
Andrey Sobolev, 2020-11-25 15:44:06

How to make a route with a complex condition?

Good afternoon. The point is this.
There is an example, which is a child of the blog route.

/news/2020/123-novost

Consisting of 3 parameters:
:news(string)/:year(int)/:post(string)

How to write path in vue-router so that:
news is optional. If it is not there, then the others do not make sense.
year - optional. But can only exist when there is a news
post - optional, but only exists when there are two previous ones.

Help solve the puzzle.
There is an idea to make them children to each other, well, they say
blog
- news
- - year (news parent)
- - - post (year parent)

But will it work?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question