paramName = '/indicator?id=123'
getParam(paramName) { let obj = {} if(!isEmpty(paramName)){ if(paramName.indexOf('?') != -1){ let str = '' str = paramName.split('?')[1] if(str.indexOf('&') != -1){ str = str.split('&') }else{ str = [str] } str.map(m => { if(m.indexOf('=') != -1){ obj[`${m.split('=')[0]}`] = m.split('=')[1] } }) } } return obj },
标签:obj,indexOf,获取,参数,split,str,paramName,let From: https://www.cnblogs.com/myqinyh/p/16626629.html