|
@@ -127,6 +127,7 @@ Component({
|
|
|
this.setData({
|
|
|
time
|
|
|
})
|
|
|
+ console.log('时间',time);
|
|
|
this.showchick()
|
|
|
},
|
|
|
formatTime(timestamp) {
|
|
@@ -142,9 +143,20 @@ Component({
|
|
|
return '昨天';
|
|
|
} else {
|
|
|
const date = new Date(timestamp);
|
|
|
- return date.toLocaleDateString(); // 显示具体日期
|
|
|
+ return this.formatDate2(date); // 显示具体日期
|
|
|
}
|
|
|
},
|
|
|
+ formatDate2(date1) {
|
|
|
+ date1 = new Date(date1);
|
|
|
+
|
|
|
+ // 获取年份、月份和日期
|
|
|
+ const year1 = date1.getFullYear();
|
|
|
+ const month1 = date1.getMonth() + 1; // 月份从0开始,所以要加1
|
|
|
+ const day1 = date1.getDate();
|
|
|
+
|
|
|
+ // 返回格式化的字符串
|
|
|
+ return `${year1}/${month1}/${day1}`;
|
|
|
+ },
|
|
|
//点击点赞按钮
|
|
|
async chickin() {
|
|
|
this.setData({
|