zjf
2023-02-24 3f9bad03f4fbca2d5c5be86e904ae832475634d8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// set function formatTime to filter
import {
  timestampToFormatTime,
  formatTimeToTimestamp
} from '@/utils'
 
/**
 * 时间戳到格式化时间
 * {{item.createTime|filterTimestampToFormatTime('MM-DD dddd')}}
 * @param {*} time
 * @param {*} cFormat
 */
export function filterTimestampToFormatTime (time, cFormat) {
  if (!cFormat) {
    cFormat = 'YYYY-MM-DD HH:mm'
  }
  if (!time || time === 0) {
    return ''
  }
  return timestampToFormatTime(time, cFormat)
}
 
/** 格式化时间到时间戳 */
export function filterFormatTimeToTimestamp (format) {
  return formatTimeToTimestamp(format)
}
 
/** 用户头像的占位图标 */
export function filterUserLazyImg (value) {
  return {
    src: value,
    error: require('@/assets/img/head.png'),
    loading: require('@/assets/img/loading.gif')
  }
}