File tree Expand file tree Collapse file tree 4 files changed +22
-10
lines changed Expand file tree Collapse file tree 4 files changed +22
-10
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ import LargeData from './components/LargeData.vue'
66import { useAppStore } from ' ./stores'
77
88import { availableLocales , loadLanguageAsync } from ' ./modules/i18n'
9+ import DarkToggle from ' ./components/DarkToggle.vue'
910
1011const age = ref (10 )
1112const app = useAppStore ()
@@ -27,6 +28,7 @@ async function toggleLocales() {
2728 <p >
2829 <em text-sm opacity-75 >{{ t('intro.desc') }}</em >
2930 </p >
31+ <DarkToggle />
3032 <p >
3133 <a icon-btn :title =" t('button.toggle_langs')" @click =" toggleLocales()" >
3234 Toggle Langs
Original file line number Diff line number Diff line change 11<script setup lang="ts">
2- import { useDark } from ' @vueuse/core'
32import { computed , reactive , ref } from ' vue'
43import { useRoute , useRouter } from ' vue-router'
54import { useAppStore } from ' ./stores'
65import EditState from ' ./components/EditState.vue'
6+ import DarkToggle from ' ./components/DarkToggle.vue'
77
88const app = useAppStore ()
9- const isDark = useDark ()
109const doubleCount = computed (() => {
1110 return app .count * 2
1211})
@@ -25,13 +24,10 @@ const route = useRoute()
2524
2625<template >
2726 <div >
28- <button @click =" isDark = !isDark" >
29- toggle dark mode
30- </button >
27+ <DarkToggle />
3128 <EditState />
3229 <RouterView />
3330 {{ doubleCount }}
34- {{ isDark }}
3531 {{ app.count }}
3632 <RouterLink to =" /hello" >
3733 <div >
Original file line number Diff line number Diff line change 1+ <script setup lang="ts">
2+ import { useDark } from ' @vueuse/core'
3+
4+ const isDark = useDark ()
5+ </script >
6+
7+ <template >
8+ <button @click =" isDark = !isDark" >
9+ toggle dark mode
10+ </button >
11+ <div >isDark: {{ isDark }}</div >
12+ </template >
Original file line number Diff line number Diff line change 44 line-height : 24px ;
55 font-weight : 400 ;
66
7- color-scheme : light dark;
8- color : rgba (255 , 255 , 255 , 0.87 );
9- background-color : # 242424 ;
10-
117 font-synthesis : none;
128 text-rendering : optimizeLegibility;
139 -webkit-font-smoothing : antialiased;
1410 -moz-osx-font-smoothing : grayscale;
1511 -webkit-text-size-adjust : 100% ;
1612}
13+
14+ html .dark {
15+ color-scheme : dark;
16+ color : rgba (255 , 255 , 255 , 0.87 );
17+ background-color : # 242424 ;
18+ }
You can’t perform that action at this time.
0 commit comments