This commit is contained in:
2025-02-23 23:36:22 +08:00
parent 73ad304863
commit fc2126f364
3 changed files with 53 additions and 55 deletions

View File

@@ -1,11 +1,8 @@
<script setup lang="ts">
import { darkTheme, dateZhCN, zhCN } from "naive-ui"
import { useDark, useMagicKeys, whenever } from "@vueuse/core"
import { useMagicKeys, whenever } from "@vueuse/core"
import Editors from "./components/Editors.vue"
import Preview from "./components/Preview.vue"
const isDark = useDark()
const { ctrl_s } = useMagicKeys({
passive: false,
onEventFired(e) {
@@ -24,11 +21,6 @@ whenever(ctrl_r, () => {})
</script>
<template>
<n-config-provider
:locale="zhCN"
:date-locale="dateZhCN"
:theme="isDark ? darkTheme : null"
>
<n-split :max="0.75" :min="0.25">
<template #1>
<Editors />
@@ -37,5 +29,4 @@ whenever(ctrl_r, () => {})
<Preview />
</template>
</n-split>
</n-config-provider>
</template>

View File

@@ -1,4 +1,9 @@
<template>
<n-config-provider
:locale="zhCN"
:date-locale="dateZhCN"
:theme="null"
>
<n-tabs pane-class="pane" default-value="html" type="segment">
<n-tab-pane name="html" tab="HTML">
<Editor language="html" :font-size="size" v-model:value="html" />
@@ -11,12 +16,12 @@
</n-tab-pane>
<n-tab-pane name="actions" tab="选项">
<n-flex vertical class="wrapper">
<n-flex align="center">
<!-- <n-flex align="center">
<span class="label">主题</span>
<n-button @click="toggleDark()">
{{ isDark ? "浅色" : "深色" }}
</n-button>
</n-flex>
</n-flex> -->
<n-flex align="center">
<span class="label">重置</span>
<n-button @click="reset('html')">HTML</n-button>
@@ -38,8 +43,10 @@
</n-flex>
</n-tab-pane>
</n-tabs>
</n-config-provider>
</template>
<script lang="ts" setup>
import { darkTheme, dateZhCN, zhCN } from "naive-ui"
import { useDark, useToggle } from "@vueuse/core"
import Editor from "./Editor.vue"
import { html, css, js, reset, size, changeSize } from "../store.ts"