tianyi 7 months ago
parent
commit
043f9c8239
  1. 28
      package1/group/shopEvaluate.vue

28
package1/group/shopEvaluate.vue

@ -45,7 +45,7 @@
{{item.createByName}}
</view>
<view class="eval-time">
{{item.createTime}}
{{item.createTime | formatTime}}
</view>
</view>
</view>
@ -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)

Loading…
Cancel
Save