-
-
Notifications
You must be signed in to change notification settings - Fork 5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(vue-app): remove trailing slash in vue-router non-strict mode #5746
Conversation
Codecov Report
@@ Coverage Diff @@
## dev #5746 +/- ##
=====================================
Coverage 95.6% 95.6%
=====================================
Files 82 82
Lines 2662 2662
Branches 683 683
=====================================
Hits 2545 2545
Misses 98 98
Partials 19 19 Continue to review full report at Codecov.
|
Co-Authored-By: Alexander Lichter <manniL@gmx.net>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Types of changes
Description
Fix #5593
According to https://github.com/vuejs/vue-router/blob/dev/src/create-route-map.js#L167 ,
vue-router
will remove the trailing slash in non strict mode.Imagine we have routes like and there is
NuxtChild
andNuxtLink to='/test/post/1'
inpages/test.vue
:In non-strict mode, after we click link, the
route.matched[0]
is always{ path: '/test', ... }
When we access
http://localhost:3000/test
,routerViewKey
is always/test
before and after clicking link.But if we access
http://localhost:3000/test/
, therouterViewKey
is/test/
fromthis.route.path
. After clicking link, therouterViewKey
is/test
fromthis.$route.matched[0].path
, sotest.vue
will be destroyed and recreated which is incorrect.Checklist: