header.vue 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <template>
  2. <div class="d-flex jc-center title_wrap">
  3. <div class="d-flex jc-center">
  4. <div class="title">
  5. <span class="title-text">{{ title }}</span>
  6. </div>
  7. </div>
  8. <div class="timers">
  9. {{ formatDate(now, "YYYY年mm月dd日 HH:MM:SS WWW") }}
  10. </div>
  11. </div>
  12. </template>
  13. <script setup lang="ts">
  14. import { onMounted, ref } from "vue";
  15. import dayjs from "dayjs";
  16. import { useNow, useTitle } from "@vueuse/core";
  17. import { formatDate } from "@/utils/formatTime";
  18. import { useThemeConfig } from "@/stores/themeConfig";
  19. import { storeToRefs } from "pinia";
  20. const storesThemeConfig = useThemeConfig();
  21. const { themeConfig } = storeToRefs(storesThemeConfig);
  22. const emit = defineEmits(["changeDate"]);
  23. const title = ref("12345政务服务便民热线");
  24. const now = useNow(); // 获取当前时间
  25. const timeValue = ref<any>([
  26. dayjs().subtract(1, "month").toDate(),
  27. dayjs().toDate(),
  28. ]); //默认近一个月
  29. emit("changeDate", timeValue.value);
  30. onMounted(() => {
  31. // title.value = `${themeConfig.value.cityName}随手拍`;
  32. title.value = "自贡随手拍";
  33. useTitle(title.value);
  34. });
  35. </script>
  36. <style scoped lang="scss">
  37. .title_wrap {
  38. height: 60px;
  39. background-size: cover;
  40. background-position: center center;
  41. position: relative;
  42. .time-picker {
  43. position: absolute;
  44. left: 30px;
  45. top: 40px;
  46. font-size: 14px;
  47. z-index: 9;
  48. }
  49. .timers {
  50. position: absolute;
  51. right: 30px;
  52. top: 40px;
  53. font-size: 18px;
  54. display: flex;
  55. align-items: center;
  56. }
  57. }
  58. .title {
  59. position: relative;
  60. text-align: center;
  61. height: 90px;
  62. line-height: 90px;
  63. .title-text {
  64. font-size: 32px;
  65. font-weight: 900;
  66. letter-spacing: 2px;
  67. width: 100%;
  68. color: #fff;
  69. }
  70. }
  71. </style>