From 51394009574c012e633d03fc69abc28ac370c8fd Mon Sep 17 00:00:00 2001 From: ZLY Date: Thu, 22 Jan 2026 14:25:19 +0800 Subject: [PATCH] =?UTF-8?q?pref(common):=20=E4=BC=98=E5=8C=96=E6=97=B6?= =?UTF-8?q?=E5=88=86=E7=A7=92=E6=A0=BC=E5=BC=8F=E5=8C=96=E5=87=BD=E6=95=B0?= =?UTF-8?q?=E7=9A=84=E8=BE=93=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/common.ts | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) 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]); }