From 620be424cd664037b9f15f1b12ec74d2048aa2c1 Mon Sep 17 00:00:00 2001 From: 鲁班七号 <9159450+luban-71@user.noreply.gitee.com> Date: 星期四, 05 一月 2023 15:56:47 +0800 Subject: [PATCH] 顶部导航展示优化。 --- src/filters/index.js | 21 +++++++++++++++++++++ 1 files changed, 21 insertions(+), 0 deletions(-) diff --git a/src/filters/index.js b/src/filters/index.js index 79f8467..d754e78 100644 --- a/src/filters/index.js +++ b/src/filters/index.js @@ -19,6 +19,27 @@ } } +// 时间戳过滤器 +export function formatDate(value) { + if (!value){ + return "---" + }else{ + let date = new Date(value); + let month = (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1) : date.getMonth()+1); + let day = (date.getDate()+1 < 10 ? '0'+(date.getDate()+1) : date.getDate()+1); + let hours = date.getHours(); + if (hours < 10) + hours = "0" + hours; + let minutes = date.getMinutes(); + if (minutes < 10) + minutes = "0" + minutes; + let time = date.getFullYear() + "-" + month + "-" + day + + " " + hours +":" + minutes ; + // + hours + ":" + minutes + return time; + } +} + /* 数字 格式化*/ export function numberFormatter(num, digits) { const si = [ -- Gitblit v1.9.2