Skip to content

Commit

Permalink
Merge branch 'master' of github.com:theajack/disable-devtool
Browse files Browse the repository at this point in the history
  • Loading branch information
theajack committed Jan 5, 2022
2 parents 5c787a4 + ea5b834 commit d85fc71
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/utils/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,14 @@ export function getNowTime () {
}

export function getUrlParam (name) {
const search = window.location.search;
if (search !== '') {
let {search} = window.location;
const {hash} = window.location;
// # 在 ? 之前,即 http://localhost/#file?key=value,会导致 search 为空。
if (search === '' && hash !== '') {
// 为 search 补上前缀'?',以便后面的逻辑处理不变。
search = `?${hash.split('?')[1]}`;
}
if (search !== '' && search !== undefined) {
const reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i');
const r = search.substr(1).match(reg);
if (r != null) {
Expand Down Expand Up @@ -123,4 +129,4 @@ export function isLogRegExpCount3 () {
resolve(count === 3);
}, 100);
});
}
}

0 comments on commit d85fc71

Please sign in to comment.