As shown in the picture, the format of the parameters I carry is as follows:
Then you can see that the upper URL is correct Chinese, but the lower URL becomes garbled characters after parsing.
Solution:
use decodeURIComponent
the function, the code is used as follows:
paste the code:
get_url_query() {
var str = decodeURIComponent(window.location.href)
var num = str.indexOf('?')
str = str.substr(num + 1)
var arr = str.split('&')
for (var i = 0; i < arr.length; i++) {
num = arr[i].indexOf('=')
if (num > 0) {
this.query[arr[i].substring(0, num)] = arr[i].substr(num + 1)
}
}
if (this.query.vin) {
this.vin = this.query.vin
console.log(this.vin)
this.get_vehicle_info()
}
},
Then you can see that the conversion is successful!