element el-date-picker 去除自带的T格式

<template>
  <div>
    <el-date-picker v-model="nInput" :type="type" :placeholder="placeholder" :readonly="readonly" :disabled="disabled" :clearable="clearable" @input="salaryChange"></el-date-picker>
  </div>
</template>

<script>
import { formatTimePicker } from '@/utils'
export default {
  props: {
    value: {
      type: String,
      default: ''
    },
    placeholder: {
      type: String
    },
    clearable: {
      type: Boolean,
      default: false
    },
    disabled: {
      type: Boolean,
      default: false
    },
    readonly: {
      type: Boolean,
      default: false
    },
    type: {
      type: String,
      default:'datetime'
    }
  },
  data() {
    return {
      nInput: null
    }
  },
  watch: {
    nInput(val, oldVal) {
      let dateVal = formatTimePicker(val,this.type)
      this.$emit('input', dateVal)
    },
    value(val, oldVal) {
      this.nInput = val
    }
  },
  created() {
    this.nInput = this.value
  },
  methods: {
    salaryChange(e) {
      // console.log(e)
    }
  }
}
</script>

<style lang="scss" scoped>
</style>

  

posted @ 2021-05-25 15:54  ˉ八月  阅读(1169)  评论(0)    收藏  举报