App.vue 971 B

1234567891011121314151617181920212223242526272829
  1. <script setup lang="ts">
  2. import type { ConfigProviderProps, ConfigProviderTheme } from "vant";
  3. import { useDark, useToggle } from "@vueuse/core";
  4. const isDark = useDark();
  5. const toggleDark = useToggle(isDark);
  6. const theme = computed<ConfigProviderTheme>(() =>
  7. isDark.value ? "dark" : "light"
  8. );
  9. const themeVars: ConfigProviderProps["themeVars"] = {};
  10. </script>
  11. <template>
  12. <van-config-provider :theme="theme" :theme-vars="themeVars" class="w-screen h-screen bg-light-900 text-dark-900 flex flex-col " :class="isDark && 'bg-dark-900 text-light-900'">
  13. <!-- <van-nav-bar title="标题">
  14. <template #right>
  15. <button @click="toggleDark()" class="text-18px">
  16. <i-carbon-moon v-show="isDark" class="text-light-900" />
  17. <i-carbon-sun v-show="!isDark" class="text-dark-900" />
  18. </button>
  19. </template>
  20. </van-nav-bar> -->
  21. <div class="overflow-y-auto">
  22. <router-view />
  23. </div>
  24. </van-config-provider>
  25. </template>