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.

Layout doesn't work when using router.push()

See original GitHub issue

I have made a custom layout called HelloLayout.vue and a HelloWorld.vue page using it and works fine. But, when I try to redirect to it from another page using this.$router.push('helloworld'), it gives error in the console as follow:

[Vue warn]: Failed to resolve async component:
function () { return resolve(name); }
Reason: Error: Cannot find module './default/default.vue'

Looks like it still try to use the default layout.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:12 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
ktsncommented, Jul 24, 2018

@edmundophie I just fixed this on vue-router-layout side. Please try to install the latest vue-router-layout (v0.1.3).

0reactions
ktsncommented, Jul 25, 2018

Yes, both layouts and pages should be able to use vue-router’s navigation guard since they are implemented on top of it. 🙂

Edit: layouts cannot use router navigation guard actually because they are not in routes.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Vue Router this.$router.push not working on methods
Solved, i changed the method this.$router.push() from my code, to this.$router.go('/') . Thanks for everyone in comments.
Read more >
Programmatic Navigation - Vue Router
To navigate to a different URL, use router.push . This method pushes a new entry into the history stack, so when the user...
Read more >
Next js router push without reload - Caritas Castellaneta
We'll start with the source code from "Redux Fundamentals" part 5: UI and React. This means the comments would update without you even...
Read more >
Vue Navigation: Use Ionic + Vue Router to Create Multi-Page ...
This guide covers how routing works in an app built with Ionic and Vue. ... This means that router.go() should not be used...
Read more >
Routing in Vue3: Navigating the Options - CODE Magazine
Shawn Wildermuth demonstrates how to use Vue Routing in a single page ... The same as router.push but doesn't add another history entry....
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