92
92
.
93
93
</div >
94
94
</footer >
95
+ <teleport to =" head" >
96
+ <link
97
+ rel =" stylesheet"
98
+ href =
" https://cdn.jsdelivr.net/npm/[email protected] /dist/css/bootstrap.min.css"
99
+ integrity =" sha256-IUOUHAPazai08QFs7W4MbzTlwEWFo7z/4zw8YmxEiko="
100
+ crossorigin =" anonymous"
101
+ />
102
+ </teleport >
95
103
</div >
96
104
</template >
97
105
@@ -109,31 +117,31 @@ export default defineComponent({
109
117
/** Dark mode */
110
118
const dark = ref (window .matchMedia (' (prefers-color-scheme: dark)' ).matches );
111
119
watch (dark, () => {
120
+ const body = document .body .classList ;
112
121
const navbar = document .querySelector (' .navbar' ).classList ;
113
122
const header = document .querySelector (' .header' ).classList ;
114
- const demo = document .querySelector (' .demo' ).classList ;
115
123
const main = document .querySelector (' main' ).classList ;
116
124
const footer = document .querySelector (' .footer' ).classList ;
117
125
if (dark .value ) {
126
+ body .remove (' text-white' , ' bg-black' );
127
+ body .add (' text-black' , ' bg-white' );
118
128
navbar .remove (' navbar-dark' , ' bg-dark' );
119
129
navbar .add (' navbar-light' , ' bg-light' );
120
130
header .remove (' bg-light' , ' text-dark' );
121
131
header .add (' bg-dark' , ' text-light' );
122
132
main .remove (' bg-white' , ' text-dark' );
123
133
main .add (' bg-black' , ' text-light' );
124
- demo .remove (' bg-light' , ' text-dark' );
125
- demo .add (' bg-dark' , ' text-light' );
126
134
footer .remove (' bg-light' , ' text-dark' );
127
135
footer .add (' bg-dark' , ' text-light' );
128
136
} else {
137
+ body .remove (' text-black' , ' bg-white' );
138
+ body .add (' text-white' , ' bg-black' );
129
139
navbar .add (' navbar-dark' , ' bg-dark' );
130
140
navbar .remove (' navbar-light' , ' bg-light' );
131
141
header .remove (' bg-dark' , ' text-light' );
132
142
header .add (' bg-light' , ' text-dark' );
133
143
main .add (' bg-white' , ' text-dark' );
134
144
main .remove (' bg-black' , ' text-light' );
135
- demo .remove (' bg-dark' , ' text-light' );
136
- demo .add (' bg-light' , ' text-dark' );
137
145
footer .add (' bg-light' , ' text-dark' );
138
146
footer .remove (' bg-dark' , ' text-light' );
139
147
}
0 commit comments