获取url字段
程序员文章站
2022-04-03 08:36:48
...
getUrlsub: function (href) {
console.log(href);
let index = href.lastIndexOf("\/");
let str = href.substring(index + 1,href.length);
return str
},
getnextUrl: function (href) {
if(href === undefined){
return 'formFields'
}else{
let urls =(href.split(/\//)[3]+'/'+href.split(/\//)[4]+'/'+href.split(/\//)[5])
console.log(urls)
return urls;
}
},
getsecondurl:function(href){
//获取最后一个斜杠之前的内容
//var htmlHref = window.location.href;
let index = href .lastIndexOf("\/");
let str = href .substring(0, index+1);
let url = str.substring(0,str.length-1)
return url
},