N
N
Nikita Kudinov2021-01-22 10:25:45
Flask
Nikita Kudinov, 2021-01-22 10:25:45

Why doesn't params change?

Set a router like this:

const routes = [
  { path: '', component: Table, name: 'main', props: true },
  { path: '/role', component: Table, name: 'roles', props: true },
]


When I click on
<router-link :to="{name: 'main', params: {role: 0}}">Все пользователи</router-link>
, router-view changes.

I have data from json pulled into all_roles and everything on the page is displayed:
<li v-for="r in all_roles" :key="parseInt(r.id)">
            <router-link :to="{name: 'roles', params: {role: parseInt(r.id)} }"></router-link>
        </li>


I'm trying this sequence:
  1. click on "All users" -> change router-view
  2. I click on the first element from all_roles -> the router-view changes
  3. I click on the second component from all_roles -> router-view does not change


And it changes only when I click again on "All users" and on any component.

Why is this happening and how to fix it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey Pastukhov, 2021-01-22
@tyllo

And if the route is so registered?

{ path: '/role/:role', component: Table, name: 'roles', props: true },

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question