Skip to content

Commit

Permalink
Merge pull request #1058 from CaoLeilei/master
Browse files Browse the repository at this point in the history
获取url参数问题的修改
  • Loading branch information
nolimits4web committed Sep 1, 2016
2 parents 43dffca + 3730354 commit 76d768c
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/js/dom7-utils.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
// DOM Library Utilites
$.parseUrlQuery = function (url) {
var url = url || location.href;
var query = {}, i, params, param;
if (url.indexOf('?') >= 0) url = url.split('?')[1];
else return query;
params = url.split('&');
for (i = 0; i < params.length; i++) {
param = params[i].split('=');
query[param[0]] = param[1];

if(typeof url === 'string' && url.length) {
url = (url.indexOf('#') > -1) ? url.split('#')[0] : url;
if(url.indexOf('?') > -1) url = url.split('?')[1];
else return query;

params = url.split('&');
for(i = 0; i < params.length; i ++) {
param = params[i].split('=');
query[param[0]] = param[1];
}
}
return query;
};
Expand Down

1 comment on commit 76d768c

@J05HI
Copy link

@J05HI J05HI commented on 76d768c Sep 16, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@CaoLeilei
Very nice now the bug with the routing is fixed :)
Thanks!!!

Please sign in to comment.