zjf
2023-03-03 26e972196ed6046bcb7fb341be86241c8300fd2b
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
36
37
38
39
40
41
42
43
<template>
  <el-date-picker
    v-model="dataValue"
    :disabled="disabled"
    style="width: 100%;"
    type="datetime"
    value-format="yyyy-MM-dd HH:mm:ss"
    placeholder="选择日期"
    @change="valueChange"/>
</template>
<script type="text/javascript">
import stringMixin from './stringMixin'
import { getDateFromTimestamp } from '@/utils'
import moment from 'moment'
 
export default {
  name: 'XhInput', // 新建 datetime
  components: {},
  mixins: [stringMixin],
  props: {
    value: {
      type: String,
      default: ''
    }
  },
  data () {
    return {}
  },
  computed: {},
  watch: {},
  mounted () {
    if (this.value && this.value.toString().length === 10) {
      // 编辑的时候 值是时间戳
      this.dataValue = moment(getDateFromTimestamp(this.value)).format(
        'YYYY-MM-DD HH:mm:ss'
      )
    }
  },
  methods: {}
}
</script>
<style lang="less" scoped>
</style>