常规js写法
minTime(min) {
let minTime = "";
let h = Math.floor(min / 60);
min -= h * 60;
if (min == 0) {
minTime = h ? "0" + h + ":00" : "";
} else {
if (min < 10) {
min = "0" + min;
}
if (h < 10) {
h = "0" + h;
}
minTime = (h ? h + "时" : "") + (min ? min + "分" : "");
}
return minTime;
},
vue 引用moment写法
minTime(min) {
return moment.utc(min * 60 * 1000).format('HH时mm分')
},
常规js写法
formatSelect(value) {
let date = new Date(value)
let year = date.getFullYear()
let month = date.getMonth() + 1
let day = date.getDate()
month = month > 9 ? month : '0' + month;
day = day > 9 ? day : '0' + day;
return year + '年' + month + '月' + day + '日'
}
vue 引用moment写法
formatSelect(value) {
return moment(value).format('YYYY年MM月DD日')
}