switchTimeFormat (time) {
   const dateTime = new Date(time)
   const year = dateTime.getFullYear()
   const month = dateTime.getMonth() + 1
   const date = dateTime.getDate()
   const hour = dateTime.getHours()
   const minute = dateTime.getMinutes()
   const second = dateTime.getSeconds()
   return `${year}-${this.addZero(month)}-${this.addZero(date)} ${this.addZero(hour)}:${this.addZero(minute)}:${this.addZero(second)`
},
addZero (v) {
     return v < 10 ? '0' + v : v
 }
Logo

前往低代码交流专区

更多推荐