过滤器时间转换
利用过滤器进行时间转换,
判断是防止传入的时间常数为空或者缺少
filters: { timeConver: function(dataStr) { if (dataStr != undefined && dataStr != "") { var dt = new Date(dataStr); var y = dt.getFullYear(); var m = dt.getMonth() + 1; if (m < 10) { m = "0" + m; } var d = dt.getDate(); if (d < 10) { d = "0" + d; } var hh = dt.getHours(); if (hh < 10) { hh = "0" + hh; } var mm = dt.getMinutes(); if (mm < 10) { mm = "0" + mm; } var ss = dt.getSeconds(); return y + "-" + m + "-" + d + " " + hh + ":" + mm; } } },