src/components/search-option/FYOptionTime.vue
@@ -1,9 +1,9 @@
<template>
  <el-form-item label="时间" :prop="prop">
    <el-date-picker
      :model-value="value"
      v-model="date"
      @change="handleChange"
      type="month"
      :type="type"
      placeholder="选择时间"
      style="width: 150px"
    />
@@ -14,6 +14,7 @@
import dayjs from 'dayjs';
const MONTH = 'month';
const DATE = 'date';
export default {
  props: {
@@ -32,24 +33,21 @@
  },
  emits: ['update:value'],
  data() {
    return {};
    return {
      date: this.value
    };
  },
  computed:{
  },
  methods: {
    handleChange(value) {
      this.$emit('update:value', value);
    },
    timeFormat() {
      switch (this.type) {
        case MONTH:
          return 'YYYY-MM';
        default:
          return 'YYYY-MM';
      }
    }
  },
  mounted() {
    if (this.initValue) {
      this.handleChange(new Date());
      this.date = new Date()
      this.handleChange(this.date);
    }
  }
};