A
A
Aleksandr2017-08-09 09:40:27
Vue.js
Aleksandr, 2017-08-09 09:40:27

Navigating through child pages?

Hello. I can't quite get my head around vue-router.
I have a page (there is more than one), on each page there is a table with the nth number of rows, and on each row there is a button to go to the information card for this very row.
dddff49981cb4679948178017c75eb67.png
So the question is, how do I correctly register routers to go to these pages?

{
        path: '',
        component: Hello,
        meta: {}
    },
    {
        path: 'Anketa_tp',
        component: Anketa_tp,
        meta: {}
    },
    {
        path: 'banks',
        component: Banks,
        meta: {}
    },

I tried like this
{
        path: 'Anketa_tp/:id',
        component: _id,
        meta: {}
    }

Is it correct?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Anton, 2017-08-09
@Fragster

У меня так:
...
    {path: '/templates', component: require('./components/Templates.vue')},
    {path: '/templates/:id', 
      component: require('./components/Template.vue'),
      props: true
    },
...

in Template.vue:
export default {
    name: 'template',
    data: function () {
      return {
///
      };
    },
    props: [
      'id'
    ],
    watch: {
      id: function() {
        this.loadTemplate();
      }
    },
    mounted: function () {
      this.loadTemplate();
    },
    methods: {
...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question