From d18dcfd8f9d7d9030036111978234e25058c6e8e Mon Sep 17 00:00:00 2001 From: xingyy <64720302+Concur-max@users.noreply.github.com> Date: Fri, 7 Mar 2025 10:06:05 +0800 Subject: [PATCH] =?UTF-8?q?refactor(app):=20=E4=BC=98=E5=8C=96=E5=9B=BE?= =?UTF-8?q?=E7=89=87=E5=8A=A0=E8=BD=BD=E5=92=8C=E6=A0=BC=E5=BC=8F=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在 ItemList 组件中,使用 OSS 图片处理功能调整图片尺寸和格式,提高加载速度 - 在 tangPopup 组件中,应用相同的图片优化处理 - 移除了未使用的 formatNumber 函数,简化了代码 --- app/pages/home/components/ItemList/index.vue | 27 +++---------------- .../components/SideButton/tangPopup.vue | 2 +- 2 files changed, 5 insertions(+), 24 deletions(-) diff --git a/app/pages/home/components/ItemList/index.vue b/app/pages/home/components/ItemList/index.vue index 96eab32..72620a3 100644 --- a/app/pages/home/components/ItemList/index.vue +++ b/app/pages/home/components/ItemList/index.vue @@ -41,27 +41,6 @@ const openShow = async (item) => { localState.value.showDetail = true currentItem.value = item } - -/** - * 将数字格式化为"250XX"格式,其中XX是两位数 - * @param {number} num - 要格式化的数字 - * @return {string} - 格式化后的字符串 - */ -function formatNumber(num) { - // 确保输入是有效数字 - if (typeof num !== 'number' && isNaN(Number(num))) { - throw new Error('输入必须是有效数字'); - } - - // 转换为数字类型(以防输入是字符串数字) - const number = Number(num); - - // 数字部分格式化为两位数,不足补0 - const formattedNum = number.toString().padStart(2, '0'); - - // 添加前缀"250"并返回结果 - return `250${formattedNum}`; -}