1. ( 需要在A页面准备传参时 ) 在中文关键字加入到地址栏前,进行两次encodeURI转码
2.在B页面时只需一次解码就可以了
3.可以是URL地址,也可以是具体乱码变量。
举例:
比如需要A页面的一个中文searchKey=‘中国’ , 传参到B页面
比如下面这样
A页面: let encodeKey = encodeURI(encodeURI(searchKey));
selectschool?keyword='+encodeKey+'&type='+type;
B页面: let decodeKey = decodeURI(encodeKey )
这时的decodeKey 就是解码后的中文字符