fix
This commit is contained in:
@@ -1,22 +1,20 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import "normalize.css"
|
import "normalize.css"
|
||||||
import { zhCN, dateZhCN, darkTheme } from "naive-ui"
|
import { zhCN, dateZhCN, darkTheme } from "naive-ui"
|
||||||
import { isDark } from "./shared/composables/dark"
|
|
||||||
import hljs from "highlight.js/lib/core"
|
import hljs from "highlight.js/lib/core"
|
||||||
import c from "highlight.js/lib/languages/c"
|
import c from "highlight.js/lib/languages/c"
|
||||||
import python from "highlight.js/lib/languages/python"
|
import python from "highlight.js/lib/languages/python"
|
||||||
import "./index.css"
|
import "./index.css"
|
||||||
|
|
||||||
const theme = computed(() => (isDark.value ? darkTheme : null))
|
|
||||||
|
|
||||||
hljs.registerLanguage("c", c)
|
hljs.registerLanguage("c", c)
|
||||||
hljs.registerLanguage("python", python)
|
hljs.registerLanguage("python", python)
|
||||||
|
|
||||||
|
const isDark = useDark()
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<n-config-provider
|
<n-config-provider
|
||||||
inline-theme-disabled
|
:theme="isDark ? darkTheme : null"
|
||||||
:theme="theme"
|
|
||||||
:locale="zhCN"
|
:locale="zhCN"
|
||||||
:date-locale="dateZhCN"
|
:date-locale="dateZhCN"
|
||||||
:hljs="hljs"
|
:hljs="hljs"
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import { EditorView } from "@codemirror/view"
|
|||||||
import { oneDark } from "../themes/oneDark"
|
import { oneDark } from "../themes/oneDark"
|
||||||
import { smoothy } from "../themes/smoothy"
|
import { smoothy } from "../themes/smoothy"
|
||||||
import { LANGUAGE } from "~/utils/types"
|
import { LANGUAGE } from "~/utils/types"
|
||||||
import { isDark } from "../composables/dark"
|
|
||||||
|
|
||||||
const styleTheme = EditorView.baseTheme({
|
const styleTheme = EditorView.baseTheme({
|
||||||
"& .cm-scroller": {
|
"& .cm-scroller": {
|
||||||
@@ -38,6 +37,9 @@ const props = withDefaults(defineProps<Props>(), {
|
|||||||
})
|
})
|
||||||
|
|
||||||
const code = ref(props.modelValue)
|
const code = ref(props.modelValue)
|
||||||
|
|
||||||
|
const isDark = useDark()
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => props.modelValue,
|
() => props.modelValue,
|
||||||
(v) => {
|
(v) => {
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
import { logout } from "../api"
|
import { logout } from "../api"
|
||||||
import { useUserStore } from "../store/user"
|
import { useUserStore } from "../store/user"
|
||||||
import { useConfigStore } from "../store/config"
|
import { useConfigStore } from "../store/config"
|
||||||
import { isDark, toggleDark } from "~/shared/composables/dark"
|
|
||||||
import { toggleLogin, toggleSignup } from "~/shared/composables/modal"
|
import { toggleLogin, toggleSignup } from "~/shared/composables/modal"
|
||||||
import { RouterLink } from "vue-router"
|
import { RouterLink } from "vue-router"
|
||||||
import { isDesktop, isMobile } from "~/shared/composables/breakpoints"
|
import { isDesktop, isMobile } from "~/shared/composables/breakpoints"
|
||||||
@@ -13,6 +12,8 @@ import {
|
|||||||
import Sunny from "../icons/Sunny.vue"
|
import Sunny from "../icons/Sunny.vue"
|
||||||
import Moon from "../icons/Moon.vue"
|
import Moon from "../icons/Moon.vue"
|
||||||
|
|
||||||
|
const isDark = useDark()
|
||||||
|
const toggleDark = useToggle(isDark)
|
||||||
const userStore = useUserStore()
|
const userStore = useUserStore()
|
||||||
const configStore = useConfigStore()
|
const configStore = useConfigStore()
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
@@ -52,7 +53,8 @@ const menus = computed<MenuOption[]>(() => [
|
|||||||
key: "rank",
|
key: "rank",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: () => h(RouterLink, { to: "/announcement" }, { default: () => "公告" }),
|
label: () =>
|
||||||
|
h(RouterLink, { to: "/announcement" }, { default: () => "公告" }),
|
||||||
key: "announcement",
|
key: "announcement",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,2 +0,0 @@
|
|||||||
export const isDark = useLocalStorage("theme-appearance", false)
|
|
||||||
export const toggleDark = useToggle(isDark)
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
export const code = ref("")
|
|
||||||
Reference in New Issue
Block a user