docs: support dark mode.

pull/28/head
士子☀️ 2 years ago
parent 39d38e074a
commit fd7ffcdfda

@ -1,10 +1,21 @@
<script setup lang="ts">
import { onMounted } from "vue";
import { init } from "@waline/client";
import { onMounted, watch, ref } from "vue";
import { init, WalineInstance } from "@waline/client";
import "@waline/client/waline.css";
import { useData } from "vitepress";
const commentsRef = ref<WalineInstance | null>(null);
const { isDark } = useData();
watch(isDark, (val: boolean) => {
if (!commentsRef.value) return;
commentsRef.value.update({
dark: val,
});
});
onMounted(() => {
init({
commentsRef.value = init({
el: "#waline",
serverURL: "https://comments.ziying.site",
dark: "auto",

@ -1,7 +1 @@
/// <reference types="vite/client" />
declare module "*.vue" {
import type { DefineComponent } from "vue";
const vueComponent: DefineComponent<{}, {}, any>;
export default vueComponent;
}

Loading…
Cancel
Save