- encodeURI() 函数可把字符串作为 URI 进行编码。
- decodeURI() 函数可//页面 a ,传递参数
- 案例
addProject() {
window.location.href = './b.html?' + encodeURI('学历')
},
对 encodeURI() 函数编码过的 URI 进行解码。
//页面 b ,接收参数
let search = location.search;
let arr = search.split("?");
console.log(decodeURI(arr[1]));//学历