add create a problem.

This commit is contained in:
2023-03-27 20:27:30 +08:00
parent 9bc1a1b5b5
commit 1698626704
10 changed files with 122 additions and 32 deletions

View File

@@ -15,10 +15,6 @@ const props = defineProps<Props>()
code.language = props.problem.languages[0] || "C"
code.value = props.problem.template[code.language] || SOURCES[code.language]
function change(value: string) {
code.value = value
}
const editorHeight = computed(() =>
isDesktop.value ? "calc(100vh - 150px)" : "calc(100vh - 200px)"
)
@@ -28,9 +24,8 @@ const editorHeight = computed(() =>
<Form :problem="props.problem" />
<Monaco
class="editor"
v-model:value="code.value"
:language="code.language"
:value="code.value"
@change="change"
:height="editorHeight"
/>
</template>

View File

@@ -1,6 +1,6 @@
<script setup lang="ts">
import { DropdownOption } from "naive-ui"
import { SOURCES } from "utils/constants"
import { LANGUAGE_SHOW_VALUE, SOURCES } from "utils/constants"
import { Problem } from "utils/types"
import { code } from "oj/composables/code"
import { isDesktop, isMobile } from "~/shared/composables/breakpoints"
@@ -47,7 +47,7 @@ const options: DropdownOption[] = props.problem.languages.map((it) => ({
transform: "translateY(3px)",
},
}),
it,
LANGUAGE_SHOW_VALUE[it],
],
value: it,
}))