Vue給url中文參數 添加編碼解碼
// 解碼用 decodeURIComponent(str)
// 編碼用 encodeURIComponent(str)
中文unicode編碼
1 function encodeUnicode(str) { 2 var res = []; 3 for (var i = 0; i < str.length; i++) { 4 res[i] = ( "00" + str.charCodeAt(i).toString(16) ).slice(-4); 5 } 6 return "\\u" + res.join("\\u"); 7 }