Created
December 10, 2018 10:11
-
-
Save kiebekierror/fde76cfb3c7fca8daf4c6a2e9e1a49e0 to your computer and use it in GitHub Desktop.
前端 JavaScript location 变量研究
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var IndexRedirect = { | |
getUrlVars : function () | |
{ | |
var vars = {}; | |
var parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, | |
function (m,key,value) | |
{ | |
vars[key] = value; | |
}); | |
return vars; | |
}, | |
// 获取当前目录 | |
getDepthPath: function () | |
{ | |
console.log(location); | |
}, | |
getSearch: function () | |
{ | |
return location.search; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment