File tree 1 file changed +7
-7
lines changed
1 file changed +7
-7
lines changed Original file line number Diff line number Diff line change 8
8
>
9
9
<svg
10
10
id =" sun"
11
- v-show =" isDark "
11
+ v-show =" isLight "
12
12
xmlns =" http://www.w3.org/2000/svg"
13
13
class =" h-6 w-6"
14
14
fill =" none"
26
26
<svg
27
27
id =" moon"
28
28
xmlns =" http://www.w3.org/2000/svg"
29
- v-show =" !isDark "
29
+ v-show =" !isLight "
30
30
class =" h-6 w-6"
31
31
fill =" none"
32
32
viewBox =" 0 0 24 24"
@@ -114,15 +114,15 @@ export default {
114
114
115
115
data () {
116
116
return {
117
- userTheme: ' light-theme' ,
118
- isDark: true
117
+ isLight: true
118
+ ? localStorage .getItem (' user-theme' ) == ' light-theme'
119
+ : false
119
120
}
120
121
},
121
122
122
123
methods: {
123
124
toggleTheme () {
124
- const activeTheme = localStorage .getItem (' user-theme' )
125
- if (activeTheme === ' light-theme' ) {
125
+ if (localStorage .getItem (' user-theme' ) == ' light-theme' ) {
126
126
this .setTheme (' dark-theme' )
127
127
} else {
128
128
this .setTheme (' light-theme' )
@@ -137,7 +137,7 @@ export default {
137
137
localStorage .setItem (' user-theme' , theme)
138
138
this .userTheme = theme
139
139
document .documentElement .className = theme
140
- this .isDark = ! this .isDark
140
+ this .isLight = ! this .isLight
141
141
},
142
142
143
143
getMediaPreference () {
You can’t perform that action at this time.
0 commit comments