mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-05-15 15:09:25 +00:00
封装isBroswer()
This commit is contained in:
@@ -32,7 +32,7 @@ export function loadExternalResource(url, type) {
|
||||
* @returns
|
||||
*/
|
||||
export function getQueryVariable(variable) {
|
||||
const query = typeof window !== 'undefined' ? window.location.search.substring(1) : ''
|
||||
const query = isBrowser() ? window.location.search.substring(1) : ''
|
||||
const vars = query.split('&')
|
||||
for (let i = 0; i < vars.length; i++) {
|
||||
const pair = vars[i].split('=')
|
||||
@@ -99,3 +99,9 @@ export function deepClone(obj) {
|
||||
* @returns
|
||||
*/
|
||||
export const delay = ms => new Promise(resolve => setTimeout(resolve, ms))
|
||||
|
||||
/**
|
||||
* 判断是否客户端
|
||||
* @returns {boolean}
|
||||
*/
|
||||
export const isBrowser = () => typeof window !== 'undefined'
|
||||
|
||||
Reference in New Issue
Block a user