filters: { formatTime: function(value) { let time = new Date(value * 1000); let year = time.getFullYear(); let month = time.getMonth() + 1; if (month < 10) { month = "0" + month; } let day = time.getDate() < 10 ? "0" + time.getDate() : time.getDate(); let hour = time.getHours() < 10 ? "0" + time.getHours() : time.getHours(); let minute = time.getMinutes() < 10 ? "0" + time.getMinutes() : time.getMinutes(); let second = time.getSeconds() < 10 ? "0" + time.getSeconds() : time.getSeconds(); return `${year}-${month}-${day} ${hour}:${minute}:${second}`; } },
直接使用{{**|formatTime}}
原文地址:https://www.cnblogs.com/Glant/p/11287885.html
时间: 2024-10-30 20:35:27