diff --git a/package1/group/shopEvaluate.vue b/package1/group/shopEvaluate.vue index b348739..21f9ec3 100644 --- a/package1/group/shopEvaluate.vue +++ b/package1/group/shopEvaluate.vue @@ -45,7 +45,7 @@ {{item.createByName}} - {{item.createTime}} + {{item.createTime | formatTime}} @@ -125,6 +125,32 @@ }, components: { + }, + filters:{ + formatTime(value) { + const date = new Date(value); + + // 获取年份 + const year = date.getFullYear(); + + // 获取月份 (getMonth 返回 0-11,所以需要 +1),并补齐0 + const month = String(date.getMonth() + 1).padStart(2, '0'); + + // 获取日 (getDate),并补齐0 + const day = String(date.getDate()).padStart(2, '0'); + + // 获取小时 (getHours),并补齐0 + const hour = String(date.getHours()).padStart(2, '0'); + + // 获取分钟 (getMinutes),并补齐0 + const minute = String(date.getMinutes()).padStart(2, '0'); + + // 获取秒 (getSeconds),并补齐0 + const second = String(date.getSeconds()).padStart(2, '0'); + + // 拼接格式:年-月-日 时:分:秒 + return `${year}-${month}-${day} ${hour}:${minute}:${second}`; + } }, onLoad(option) { this.shopItem = JSON.parse(option.item)