diff --git a/src/App.vue b/src/App.vue index b1c45cc..c25bfd2 100644 --- a/src/App.vue +++ b/src/App.vue @@ -14,9 +14,12 @@ const isDark = useDark() :date-locale="dateZhCN" :theme="isDark ? darkTheme : null" > - - - - + + + + + + +./themes/breakpoints diff --git a/src/components/CodeEditor.vue b/src/components/CodeEditor.vue index 245367f..dd0574b 100644 --- a/src/components/CodeEditor.vue +++ b/src/components/CodeEditor.vue @@ -19,7 +19,7 @@ interface Props { } const props = withDefaults(defineProps(), { - language: "c", + language: "python", fontSize: 24, readonly: false, placeholder: "", @@ -45,10 +45,10 @@ watch( ) const lang = computed(() => { - if (props.language === "c") { - return cpp() + if (props.language === "python") { + return python() } - return python() + return cpp() }) function onChange(v: string) { diff --git a/src/composables/code.ts b/src/composables/code.ts index 35ba8b7..1f5dff5 100644 --- a/src/composables/code.ts +++ b/src/composables/code.ts @@ -1,6 +1,6 @@ import { ref } from "vue" import copyTextToClipboard from "copy-text-to-clipboard" -import { Code } from "../types" +import { Code, LANGUAGE } from "../types" import { sources } from "../templates" import { submit } from "../api" @@ -21,6 +21,11 @@ export function reset() { output.value = "" } +export function changeLanguage(language: LANGUAGE) { + code.value.value = sources[language] + output.value = "" +} + export async function run() { loading.value = true const cleanCode = code.value.value.trim() diff --git a/src/desktop/Header.vue b/src/desktop/Header.vue index 1284692..fb09d88 100644 --- a/src/desktop/Header.vue +++ b/src/desktop/Header.vue @@ -1,18 +1,29 @@