g-page.vue 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <template>
  2. <view
  3. :class="['hz-page', store.appOption.theme === 'dark' ? 'theme-dark' : 'theme-light']"
  4. :style="{
  5. '--theme-bg-color': themeStyle.bgColor,
  6. '--theme-bg-color-light-1': themeStyle.bgColorLight1,
  7. '--theme-bg-white-color': themeStyle.bgWhiteColor,
  8. '--theme-bg-color-deep': themeStyle.bgColorDeep,
  9. '--theme-bg-book-color': themeStyle.bgColorBook,
  10. '--theme-primary-color': themeStyle.primaryColor,
  11. '--theme-primary-book-color': themeStyle.primaryBookColor,
  12. '--theme-primary-color-light-1': themeStyle.primaryColorLight1,
  13. '--theme-grey-color': themeStyle.greyColor,
  14. '--theme-link-color': themeStyle.linkColor,
  15. '--theme-border-color': themeStyle.borderColor,
  16. '--theme-border-color-light-1': themeStyle.borderColorLight1,
  17. '--theme-light-icon-color': themeStyle.lightIconColor,
  18. '--theme-grey-icon-color': themeStyle.greyIconColor,
  19. '--theme-icon-active-color': themeStyle.iconActiveColor,
  20. '--theme-icon-link-color': themeStyle.iconLinkColor,
  21. }"
  22. >
  23. <slot></slot>
  24. </view>
  25. </template>
  26. <script setup lang="ts">
  27. import { computed } from "vue";
  28. import store from "@/store";
  29. const pages = getCurrentPages();
  30. let currentRoute = pages[pages.length - 1].route;
  31. // console.log("当前页面路径:" + currentRoute);
  32. const themeStyle = computed(() => {
  33. let isDark = store.appOption.theme === "dark";
  34. if (currentRoute === "pages/reader/index") {
  35. isDark = store.bookOption.theme === "dark";
  36. }
  37. return {
  38. bgColor: isDark ? "#2A241D" : "#FEF7F1",
  39. bgColorLight1: isDark ? "#3B352E" : "#F4EEE7",
  40. bgColorDeep: isDark ? "#1D1710" : "#f4eee7",
  41. bgWhiteColor: isDark ? "#38312B" : "#f1edea",
  42. bgColorBook: isDark ? "#4c4945" : "#c0a374",
  43. lightIconColor: isDark ? "#FEF7F1" : "#251e18",
  44. greyIconColor: isDark ? "#a8a19a" : "#554334",
  45. iconActiveColor: isDark ? "#EC5D57" : "#D44842",
  46. iconLinkColor: isDark ? "#4F5C75" : "#92afe2",
  47. primaryColor: isDark ? "#E9E3DC" : "#251e18",
  48. primaryBookColor: isDark ? "#c9c9c9" : "#482936",
  49. primaryColorLight1: isDark ? "#BDB7B1" : "#554e48",
  50. greyColor: isDark ? "#8F8982" : "#857f78",
  51. linkColor: isDark ? "#7E9EDA" : "#92afe2",
  52. borderColor: isDark ? "#5d5c5a" : "#eae0e0",
  53. borderColorLight1: isDark ? "#383838" : "#eee",
  54. };
  55. });
  56. </script>