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