Layout doesn't work when using router.push()
See original GitHub issueI 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:
- Created 5 years ago
- Comments:12 (7 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@edmundophie I just fixed this on vue-router-layout side. Please try to install the latest vue-router-layout (v0.1.3).
Yes,
both layouts andpages 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.