mirror of https://github.com/layui/layui
parent
3617209874
commit
a7267a4b5d
|
@ -156,7 +156,7 @@
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// 或许配置及临时缓存信息
|
// 获取配置及临时缓存信息
|
||||||
Class.prototype.cache = Object.assign(config, cache);
|
Class.prototype.cache = Object.assign(config, cache);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -521,12 +521,16 @@
|
||||||
var hash = hash || location.hash;
|
var hash = hash || location.hash;
|
||||||
var data = {
|
var data = {
|
||||||
path: [],
|
path: [],
|
||||||
|
pathname: [],
|
||||||
search: {},
|
search: {},
|
||||||
hash: (hash.match(/[^#](#.*$)/) || [])[1] || '',
|
hash: (hash.match(/[^#](#.*$)/) || [])[1] || '',
|
||||||
href: ''
|
href: ''
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!/^#/.test(hash)) return data; // 禁止非路由规范
|
// 禁止非 hash 路由规范
|
||||||
|
if (!/^#/.test(hash)) {
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
hash = hash.replace(/^#/, '');
|
hash = hash.replace(/^#/, '');
|
||||||
data.href = hash;
|
data.href = hash;
|
||||||
|
@ -540,6 +544,7 @@
|
||||||
}() : data.path.push(item);
|
}() : data.path.push(item);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
data.pathname = data.path; // path → pathname, 与 layui.url 一致
|
||||||
return data;
|
return data;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue