出现如下报错:
Uncaught URIError: URI malformed
原因:
由于decodeURI转码时,通过%进行解析,如果字符串中存在%(如: ‘0.9%氯化钠注射液’),则会出现
URI malformed
解决:
将字符串中的%替换为25%
const percent2percent25 = (URI) => {
if(URI.indexOf('%') > -1) {
return URI.replace(/%/g,'%25')
}else{
return URI;
}
}
网友评论