标签:eth lte 结合 pat imp seconds dstar ring min
<td>{{item.ctime | timeFormat(‘yyyy-MM-dd‘)}}</td> //pattern = "" 形参的默认值,如果传过来的是undefined则为空 Vue.filter(‘timeFormat‘,function(timestr,pattern = ""){ var date = new Date(timestr) var y = date.getFullYear() var m = (date.getMonth()+1).toString().padStart(2,‘0‘) //padStart(位数,‘填充字符‘) 不足位数的填充,padEnd往后填充 var d = date.getDate().toString().padStart(2,‘0‘) if(pattern.toLowerCase()==‘yyyy-mm-dd‘){ return `${y}-${m}-${d}` }else{ var hh = date.getHours() var mm = date.getMinutes() var ss = date.getSeconds() return `${y}-${m}-${d} ${hh}:${mm}:${ss}` } })
import moment from ‘moment‘ Vue.filter(‘timeformat‘,function(msg,pattern="YYYY_MM_DD HH:MM:SS"){ return moment(msg).format(pattern) })
标签:eth lte 结合 pat imp seconds dstar ring min
原文地址:https://www.cnblogs.com/lskzj/p/9358728.html