filters.js 663 B

1234567891011121314151617181920212223
  1. /**
  2. *
  3. * @authors Your Name (you@example.org)
  4. * @date 2018-01-07 09:25:12
  5. * 自定义过滤器,或许有用
  6. */
  7. Vue.filter('date',function(time){
  8. let oDate=new Date(time*1000);
  9. //应该在年月日时分秒前面是否加0做判断
  10. return oDate.getFullYear()+'-'+(oDate.getMoth()+1)+'-'+oData.getDate()
  11. +' '+oDate.getHours()+':'oDate.getMinutex()+':'+oDate.getSeconds();
  12. })
  13. /*
  14. 局部过滤器
  15. filters:{
  16. date(){
  17. let oDate=new Date(time*1000);
  18. //应该在年月日时分秒前面是否加0做判断
  19. return oDate.getFullYear()+'-'+(oDate.getMoth()+1)+'-'+oData.getDate()
  20. +' '+oDate.getHours()+':'oDate.getMinutex()+':'+oDate.getSeconds();
  21. }
  22. }
  23. */