This commit is contained in:
2024-01-23 14:36:21 +08:00
parent d37c124c5a
commit 946ec691af
16 changed files with 198 additions and 45 deletions

View File

@@ -3,13 +3,14 @@ import { Code, LANGUAGE, Cache, Status } from "../types"
import { sources } from "../templates"
import { submit } from "../api"
import { useStorage } from "@vueuse/core"
import { isMobile } from "./breakpoints"
const defaultLanguage = "python"
const cache: Cache = {
language: useStorage<LANGUAGE>("code_language", defaultLanguage),
input: useStorage("code_input", ""),
fontsize: useStorage("fontsize", 24),
fontsize: useStorage("fontsize", isMobile.value ? 20 : 24),
code: {
python: useStorage("code_python", sources["python"]),
c: useStorage("code_c", sources["c"]),
@@ -24,7 +25,7 @@ export const input = ref(cache.input.value)
export const output = ref("")
export const status = ref(Status.NotStarted)
export const loading = ref(false)
export const size = ref(24)
export const size = ref(cache.fontsize)
watch(size, (value: number) => {
cache.fontsize.value = value