From 33657a5f19bde01e9f70ac676cd1f229a1465607 Mon Sep 17 00:00:00 2001 From: wujingjing <gersonwu@qq.com> Date: 星期一, 19 八月 2024 09:37:20 +0800 Subject: [PATCH] 测试amis兼容性效果 --- src/utils/util.ts | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/src/utils/util.ts b/src/utils/util.ts index d35d575..093d5d7 100644 --- a/src/utils/util.ts +++ b/src/utils/util.ts @@ -541,7 +541,8 @@ * 鏈�杩� n 澶╃殑 startDate銆乪ndDate * @param dates */ -export const getRecentDateRange = (dates: number) => { +export const getRecentDateRange = (dates: number, includesCurrent = true) => { + dates = includesCurrent ? dates - 1 : dates; // 鑾峰彇褰撳墠鏃ユ湡 const endDate = new Date(); const startDate = new Date(); @@ -704,6 +705,7 @@ }; export function getTextWidth(text: string, option: GetTextWidthOption) { + if (!text) return 0; const { size = '14px', family = 'Microsoft YaHei' } = option; const spanEle = document.createElement('span'); document.body.appendChild(spanEle); -- Gitblit v1.9.3