Skip to content

Commit fdc7e3c

Browse files
committed
Rewrite the demo code with Vue3 setup.
Each demo was divided into components. Fixed a bug that the markdown demo was not working.
1 parent de5f95e commit fdc7e3c

12 files changed

+610
-404
lines changed

dev/App.vue

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,14 @@
9292
.
9393
</div>
9494
</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>
95103
</div>
96104
</template>
97105

@@ -109,31 +117,31 @@ export default defineComponent({
109117
/** Dark mode */
110118
const dark = ref(window.matchMedia('(prefers-color-scheme: dark)').matches);
111119
watch(dark, () => {
120+
const body = document.body.classList;
112121
const navbar = document.querySelector('.navbar').classList;
113122
const header = document.querySelector('.header').classList;
114-
const demo = document.querySelector('.demo').classList;
115123
const main = document.querySelector('main').classList;
116124
const footer = document.querySelector('.footer').classList;
117125
if (dark.value) {
126+
body.remove('text-white', 'bg-black');
127+
body.add('text-black', 'bg-white');
118128
navbar.remove('navbar-dark', 'bg-dark');
119129
navbar.add('navbar-light', 'bg-light');
120130
header.remove('bg-light', 'text-dark');
121131
header.add('bg-dark', 'text-light');
122132
main.remove('bg-white', 'text-dark');
123133
main.add('bg-black', 'text-light');
124-
demo.remove('bg-light', 'text-dark');
125-
demo.add('bg-dark', 'text-light');
126134
footer.remove('bg-light', 'text-dark');
127135
footer.add('bg-dark', 'text-light');
128136
} else {
137+
body.remove('text-black', 'bg-white');
138+
body.add('text-white', 'bg-black');
129139
navbar.add('navbar-dark', 'bg-dark');
130140
navbar.remove('navbar-light', 'bg-light');
131141
header.remove('bg-dark', 'text-light');
132142
header.add('bg-light', 'text-dark');
133143
main.add('bg-white', 'text-dark');
134144
main.remove('bg-black', 'text-light');
135-
demo.remove('bg-dark', 'text-light');
136-
demo.add('bg-light', 'text-dark');
137145
footer.add('bg-light', 'text-dark');
138146
footer.remove('bg-dark', 'text-light');
139147
}

0 commit comments

Comments
 (0)