Поправки порядка загрузки компонентов и сопутствующих багов

This commit is contained in:
Book Pauk
2019-07-21 14:39:06 +07:00
parent 0d41171e9d
commit 9af055ec54
7 changed files with 55 additions and 19 deletions

View File

@@ -166,3 +166,27 @@ export function applyObjDiff(obj, diff, isAddChanged) {
return result;
}
export function parseQuery(str) {
if (typeof str != 'string' || str.length == 0)
return {};
let s = str.split('&');
let s_length = s.length;
let bit, query = {}, first, second;
for (let i = 0; i < s_length; i++) {
bit = s[i].split('=');
first = decodeURIComponent(bit[0]);
if (first.length == 0)
continue;
second = decodeURIComponent(bit[1]);
if (typeof query[first] == 'undefined')
query[first] = second;
else
if (query[first] instanceof Array)
query[first].push(second);
else
query[first] = [query[first], second];
}
return query;
}