如下filters如何调用method中的padDate并且传值呢?filters: { formatDate: function(value) { let _this = this; let date = new Date(value); let year = date.getFullYear(); let month = padDate(date.getMonth()+1); let day = padDate(date.getDate()); let hour = padDate(date.getHours()); let minutes = padDate(date.getMinutes()); let seconds = padDate(date.getSeconds()); return year +'-'+month +'-'+day+''+hour+':'+minutes+':'+seconds;
}},methods: { padDate(value){ return value <10?'0'+value :value;
}}
添加回答
举报
0/150
提交
取消