<script setup lang="ts">
import { useVModel } from "@vueuse/core";
import { DateModelType } from "element-plus";

const props = withDefaults(
  defineProps<{
    modelValue?: [DateModelType, DateModelType];
    prefix?: string;
  }>(),
  {
    prefix: ""
  }
);

const value = useVModel(props, "modelValue");
</script>

<template>
  <el-date-picker
    v-model="value"
    :start-placeholder="prefix + '开始时间'"
    :end-placeholder="prefix + '结束时间'"
    type="daterange"
    style="width: 100%"
    value-format="YYYY-MM-DD"
  />
</template>
