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