You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

21 lines
500 B

3 years ago
  1. import Vue from 'vue'
  2. import {
  3. date
  4. } from '@/common/js/util'
  5. Vue.filter('date', (timeStamp, format='Y-m-d H:i')=>{
  6. if(!timeStamp) return '';
  7. return date(format, timeStamp);
  8. })
  9. Vue.filter('friendDate', (timeStamp, format='Y-m-d H:i')=>{
  10. if(!timeStamp) return '';
  11. return date(format, timeStamp);
  12. })
  13. Vue.filter('price', (price, fixed=0)=>{
  14. if(!price || isNaN(price)){
  15. return 0
  16. }
  17. return fixed > 0 ? parseFloat(price).toFixed(fixed) : + parseFloat(price).toFixed(2);
  18. })