diff --git a/src/utils/common.ts b/src/utils/common.ts index 24919a5..e5d10af 100644 --- a/src/utils/common.ts +++ b/src/utils/common.ts @@ -20,13 +20,14 @@ export const getObjType = (obj) => { '[object RegExp]': 'regExp', '[object Undefined]': 'undefined', '[object Null]': 'null', - '[object Object]': 'object', + '[object Object]': 'object' }; if (obj instanceof Element) { return 'element'; } return map[toString.call(obj)]; }; + // 新窗口打开处理函数 export function openWindow(url: string, opts?: OpenWindowOptions) { const { target = '_blank', ...others } = opts || {}; @@ -210,12 +211,12 @@ export function formatSeconds(value: string) { if (secondTime > 0) { result = `${parseInt(`${secondTime}`, 10)}秒`; } - if (minuteTime > 0) { - result = `${parseInt(`${minuteTime}`, 10)}分${result}`; - } - if (hourTime > 0) { - result = `${parseInt(`${hourTime}`, 10)}小时${result}`; - } + // if (minuteTime > 0) { + // result = `${parseInt(`${minuteTime}`, 10)}分${result}`; + // } + // if (hourTime > 0) { + // result = `${parseInt(`${hourTime}`, 10)}小时${result}`; + // } return result; } @@ -258,9 +259,11 @@ export const deepClone = (data) => { let obj; if (type === 'array') { obj = []; - } else if (type === 'object') { + } + else if (type === 'object') { obj = {}; - } else { + } + else { //不再具有下一层次 return data; } @@ -268,7 +271,8 @@ export const deepClone = (data) => { for (let i = 0, len = data.length; i < len; i++) { obj.push(deepClone(data[i])); } - } else if (type === 'object') { + } + else if (type === 'object') { for (const key in data) { obj[key] = deepClone(data[key]); }