fix(vue-app): remove trailing slash in vue-router non-strict mode#5746
Merged
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 19Continue to review full report at Codecov.
|
Co-Authored-By: Alexander Lichter <manniL@gmx.net>
pi0
approved these changes
May 15, 2019
7 tasks
12 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Types of changes
Description
Fix #5593
According to https://github.com/vuejs/vue-router/blob/dev/src/create-route-map.js#L167 ,
vue-routerwill remove the trailing slash in non strict mode.Imagine we have routes like and there is
NuxtChildandNuxtLink 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,routerViewKeyis always/testbefore and after clicking link.But if we access
http://localhost:3000/test/, therouterViewKeyis/test/fromthis.route.path. After clicking link, therouterViewKeyis/testfromthis.$route.matched[0].path, sotest.vuewill be destroyed and recreated which is incorrect.Checklist: