<template>
  <div style="display:flex;flex-direction:row;justify-content:flex-start;align-items:center;">
    <a-input v-model:value="inputValue" placeholder="请输入内容" style="width: 220px;"/>
    <a-date-picker class="unlimitdatepicker" v-model:value="dateValue" @change="datepickerChange" placeholder="选择日期"></a-date-picker>
  </div>
</template>

<script>
import { dateFormat } from '../utils/gw_date';
export default {
  name: 'UnLimitDatePicker',
  props: ['type', 'value'],
  watch: {
    inputValue: function () {
      if (this.inputValue != '') {
        this.dateValue = this.inputValue;
      }
      this.$emit('input', this.inputValue);
    },
    value: function () {
      this.inputValue = this.value;
    },
  },
  data() {
    return {
      dateValue: '',
      inputValue: '',
    };
  },
  mounted: function () {
    this.inputValue = this.value;
  },
  created() {},
  methods: {
    datepickerChange: function (params) {
      console.log('datepickerChange' + params);
      this.inputValue = dateFormat(params, 'yyyy-MM-dd');
    },
  },
};
</script>

<style lang='less' scoped>

</style>
