mirror of
https://github.com/XTLS/Xray-docs-next.git
synced 2025-01-20 09:41:41 +03:00
36 lines
877 B
Vue
36 lines
877 B
Vue
<template>
|
|
<ParentLayout>
|
|
<template v-slot:navbar-after>
|
|
<ThemeToggle />
|
|
</template>
|
|
</ParentLayout>
|
|
</template>
|
|
|
|
<script lang="ts">
|
|
import ParentLayout from "@vuepress/theme-default/lib/layouts/Layout.vue";
|
|
import ThemeToggle from "../components/ThemeToggle.vue";
|
|
import { defineComponent } from "vue";
|
|
|
|
export default defineComponent({
|
|
components: {
|
|
ParentLayout,
|
|
ThemeToggle,
|
|
},
|
|
beforeMount() {
|
|
function setTheme(newTheme) {
|
|
const html = document.getElementsByTagName("html")[0];
|
|
html.setAttribute("theme", newTheme);
|
|
}
|
|
var dark = window.matchMedia("(prefers-color-scheme: dark)");
|
|
dark.addEventListener("change", (e) => {
|
|
setTheme(e.matches ? "dark" : "light");
|
|
});
|
|
setTheme(dark.matches ? "dark" : "light");
|
|
},
|
|
});
|
|
</script>
|
|
|
|
<style lang="sass">
|
|
//@import "../styles/default/index.scss"
|
|
</style>
|