<template>
  <div>
    <el-tooltip :disabled="isDisabled" :content="typeShowCurrentValue" placement="top" :effect="$attrs.effect">
      <el-date-picker v-model="currentValue" v-bind="$attrs" v-on="$listeners"></el-date-picker>
    </el-tooltip>
  </div>
</template>

<script>
export default {
  name: 'tipsDatePicker',
  props: {
    // v-model绑定的数据
    value: {
      type: [Array, String],
      default: function () {
        return null
      }
    }
  },
  computed: {
    isDisabled () {
      return this.typeShowCurrentValue.length === 0
    },
    currentValue: {
      get: function () {
        return this.value
      },
      set: function (value) {
        this.$emit('input', value)
      }
    },
    typeShowCurrentValue () {
      if (this.$attrs.autoShow) {
        return this.$attrs.autoShow
      }
      if (this.currentValue && this.currentValue.length > 0) {
        return this.currentValue[0] + '至' + this.currentValue[1]
      }
      return ''
    }
  },
  methods: {
  }
}
</script>

<style scoped>

</style>
