Closed wangzhiguoengineer closed 10 months ago
The address bar of the browser is still invalid: https://test.com/path?query=%abc%
Browsers display URL differently from what location
contains. Make sure to check that. Vue Router goal is to give you unencoded values in query, hash and params for easier use. As noted in the migration guide, the encoding behavior has changed to be consistent and predictable. If after reading the migration guide you have a bug to report, make sure to provide a reproduction
@posva The invalid parameter mentioned here is mainly the% symbol, and the% symbol is not automatically encoded by the browser. vue-router@3 encodes% and invokes history.replaceState to automatically refresh the URL in the address bar. vue-router@4 also invokes history.replaceState to refresh the URL in the address bar, but does not encode the% symbol. Can vue-router@4 encode invalid parameter% in the address bar and refresh URL parameters in the address bar?
Reproduction
vue-router@4
Steps to reproduce the bug
Assume that the URL of the web project to be accessed is:
https://test.com/path?query=%abc%
Expected behavior
Access via vue-router@3, parameter
%abc%
is automatically replaced with%25abc%25
by history.replaceState The address bar of the final browser displays:https://test.com/path?query=%25abc%25
Actual behavior
The
%abc%
parameter is not automatically replaced with%25abc%25
when accessed through vue-router@4. The address bar of the browser is still invalid:https://test.com/path?query=%abc%
Additional information
The main impacts are: