default-time.vue 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. <template>
  2. <div class="block">
  3. <span class="demonstration">Start and end date time 12:00:00</span>
  4. <el-date-picker v-model="value1" type="datetimerange" start-placeholder="Start Date" end-placeholder="End Date" :default-time="defaultTime1" />
  5. </div>
  6. <div class="block">
  7. <span class="demonstration">Start date time 12:00:00, end date time 08:00:00</span>
  8. <el-date-picker v-model="value2" type="datetimerange" start-placeholder="Start Date" end-placeholder="End Date" :default-time="defaultTime2" />
  9. </div>
  10. </template>
  11. <script lang="ts" setup>
  12. import { ref } from 'vue'
  13. const value1 = ref('')
  14. const value2 = ref('')
  15. const defaultTime1 = new Date(2000, 1, 1, 12, 0, 0) // '12:00:00'
  16. const defaultTime2: [Date, Date] = [new Date(2000, 1, 1, 12, 0, 0), new Date(2000, 2, 1, 8, 0, 0)] // '12:00:00', '08:00:00'
  17. </script>
  18. <style scoped>
  19. .block {
  20. padding: 30px 0;
  21. text-align: center;
  22. border-right: solid 1px var(--el-border-color);
  23. flex: 1;
  24. }
  25. .block:last-child {
  26. border-right: none;
  27. }
  28. .block .demonstration {
  29. display: block;
  30. color: var(--el-text-color-secondary);
  31. font-size: 14px;
  32. margin-bottom: 20px;
  33. }
  34. </style>