拼接对象为含有?&的string
作者:互联网
class Url{
/**
*
* @param path
* @param filter
* @returns {string}
*/
static getPath(path, filter){
path = path + '?'
for(let k in filter){
if(filter[k] === null){
continue
}
if(Array.isArray(filter[k])){
for (let k2 in filter[k]){
path = path+k+'[]='+filter[k][k2]+'&'
}
}else{
path = path+k+'='+filter[k]+'&'
}
}
path = path.substr(0, path.length - 1)
return path
}
}
export default Url
标签:string,含有,param,filter,k2,拼接,let,path 来源: https://www.cnblogs.com/ch-zaizai/p/16359784.html