mirror of
https://github.com/RemainderTime/spring-boot-base-demo.git
synced 2026-03-07 12:40:46 +08:00
解决页面传递中文参数乱码问题
This commit is contained in:
@@ -62,9 +62,9 @@
|
||||
.then(function (response) {
|
||||
var data = response.data;
|
||||
if (data.code == 200) {
|
||||
|
||||
var param = "?token=" + data.data.token + "&name=" + data.data.name;
|
||||
window.location.href = encodeURI("success.html" + param)
|
||||
//中文需要进行两次encodeURI转码( encodeURI:把URI字符串采用UTF-8编码格式转化成escape格式的字符串)
|
||||
var param = "?token=" + data.data.token + "&name=" + encodeURI(encodeURI(data.data.name));
|
||||
window.location.href ="success.html" + param
|
||||
} else {
|
||||
alert(data.message)
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
},
|
||||
mounted: function () {
|
||||
this.token = this.getData("token");
|
||||
//只需要转一次码
|
||||
this.name = decodeURI(this.getData("name"));
|
||||
},
|
||||
methods: {
|
||||
|
||||
Reference in New Issue
Block a user