I'm trying to have a homepage with tabs containing 2 lists, with 1 open by default.
I have the following route config, I've changed the names to simplify
let routes = [{
path: '/',
name: 'home',
component: require('./views/Home.vue'),
children: [{
path: 'list1',
name: 'home.list1',
component: require('./views/List1.vue')
}, {
path: 'list2',
name: 'home.list2',
component: require('./views/List2.vue')
}]
}
Inside ./views/Home.vue
I have a <router-view></router-view>
below 2 <router-link>
s for each tab (child route).
When I visit the app route http://domain/
I would like to activate the list1
tab. The only way I can currently do this is if I visit http://domain/list1
.
I have tried
children: [{
path: '',
name: 'home.list1'
and this initially works well, however if I visit http://domain/list2
both my tab links (router-links) have the active state.
JSFiddle which I can't get to run but helps for context
Is there a better solution to this?
<router-link>
will be active – Asterismexact
prop on router link router.vuejs.org/en/api/router-link.html – Illative