update
This commit is contained in:
@@ -22,6 +22,8 @@ function findError(line: string, language = "python") {
|
||||
"NameError: name '(.*?)' is not defined": (name: string) =>
|
||||
`命名错误,${name} 不知道是什么东西`,
|
||||
"IndentationError: expected an indented block": "缩进错误:这一行需要缩进",
|
||||
'TypeError: can only concatenate str \\(not "(.*?)"\\) to str':
|
||||
"文字和数字不能相加",
|
||||
}
|
||||
const c: any = {}
|
||||
const regex = { c, python }[language]
|
||||
|
||||
@@ -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
|
||||
|
||||
4
src/composables/tab.ts
Normal file
4
src/composables/tab.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
import { ref } from "vue"
|
||||
import { Tab } from "../types"
|
||||
|
||||
export const tab = ref<Tab>("code")
|
||||
Reference in New Issue
Block a user