D
D
Denioo2020-06-30 11:57:34
Vue.js
Denioo, 2020-06-30 11:57:34

How to pass dynamic route id to tabs?

Good afternoon, I have a question.
There are tabs that I create like this:

data() {
      return {
        tabs: [
          {title: "Данные машины", url: '/cars/data/:id', exact: true},
          {title: "Модификации машины", url: '/cars/data/:id/modified'},
          {title: "Запчасти на машину", url: '/user/data/:id/spares'}
        ]
      };
    },


I take them out like this:
<router-link
        v-for="tab of tabs"
        v-bind:key="tab.url"
        v-bind:tab="tab"
        tag="a"
        active-class="navbar__link--active"
        class="navbar__link"
        :to="tab.url"
        :exact="tab.exact"
    >
      {{tab.title}}
    </router-link>

Where :id will dynamic routers pull up from store(id). Here's how to enter this id in tabs? Or is it best to create data for the navbar in the store and already pass it as a regular getter?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Anton, 2020-06-30
@Fragster

:to="`/cars/data/${tab.id}/modified`"

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question