question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[2.0] Waring about named route with default child route not showing in non-minified build

See original GitHub issue

When i use <router-link :to="{ name: 'home' }">/home</router-link>, i can’t get the correct results. See.

But <router-link to="/home">/home</router-link> is right. See

When use router.push, the result is same as the first case.

Please help me, thanks.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:4
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

24reactions
LinusBorgcommented, Oct 14, 2016

You should be seeing a warning about this, but appearntly there’s a problem with that. I will check that out.

The warning does appear when you use e.g. the vue-cli webpack template and have run npm run dev

The warning would read:

Named Route 'home' has a default child route.
When navigating to this named route (:to="{name: 'home'"), the default child route will not be rendered.
Remove the name from this route and use the name of the default child route for named links instead.`

Which esseantially means your route config should look like this:

const router = new VueRouter({
  routes: [
    { path: '/home', component: resolve => resolve(Home),
      children: [
        { path: '', name: 'home', component: resolve => resolve(Welcome) },
        { path: 'welcome', name: 'welcome', component: resolve => resolve(Welcome) },
      ]
    }
  ]
})

Sorry for the inconvenience, will see how to fix that the non-minified release does show the warning in the future, but it apüpears that warnings in this build are not shown generally.

16reactions
LinusBorgcommented, Sep 12, 2017

The error is telling you what to do, just follow the instructions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Vue.js nested routing with default child - Stack Overflow
Vue now warns this pattern: Named Route 'upload' has a default child route. When navigating to this named route (:to="{name: 'upload'"), the ...
Read more >
Why vue router giving me this warning? - Laracasts
When navigating to this named route (:to="{name: 'Layout'"), the default child route will not be rendered. Remove the name from this route and...
Read more >
48 answers on StackOverflow to the most popular Angular ...
In an Angular application (current in the 2.0.0-beta.0 release as I write this), how do you determine what the currently active route is?...
Read more >
AngularJS to Angular concepts: Quick reference
AngularJS is the name for all v1.x versions of Angular. ... In Angular, href is no longer used for routing. ... Angular has...
Read more >
Changelog - Cypress Documentation
"Open in IDE" is no longer displayed in the command log for component tests. ... This matches the previous behavior that was default...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found