执行param.replace(/\s+/g,"") 后控制台报找不到replace方法。 解决办法 if(typeof(param)=='string'){ param.replace(/\s+/g,"") }