abu abu
abu abu

Reputation: 7022

Navigation in Vue.js

I have below code in my HTML Code.

<router-link :to="{ path: '/word/',name: 'word', params: { id: word._id }}"></router-link>

My route settings in index.js like below

export default new Router({
    mode: 'history',
    routes: [
        {
            path: '/',
            name: 'mainbody',
            component: MainBody
        },
        {
            path: '/word/:id',
            name: 'word',
            component: Word
        }
    ]
});

But it is not working.

Upvotes: 0

Views: 51

Answers (1)

niclas_4
niclas_4

Reputation: 3674

Try <router-link :to="'/word/' + word._id"></router-link>

Upvotes: 1

Related Questions