slim code highlight.
This commit is contained in:
@@ -4,20 +4,12 @@ import { zhCN, dateZhCN, darkTheme } from "naive-ui"
|
||||
import { isDark } from "./shared/composables/dark"
|
||||
import hljs from "highlight.js/lib/core"
|
||||
import c from "highlight.js/lib/languages/c"
|
||||
import cpp from "highlight.js/lib/languages/c"
|
||||
import java from "highlight.js/lib/languages/java"
|
||||
import python from "highlight.js/lib/languages/python"
|
||||
import javascript from "highlight.js/lib/languages/javascript"
|
||||
import go from "highlight.js/lib/languages/go"
|
||||
|
||||
const theme = computed(() => (isDark.value ? darkTheme : null))
|
||||
|
||||
hljs.registerLanguage("c", c)
|
||||
hljs.registerLanguage("cpp", cpp)
|
||||
hljs.registerLanguage("java", java)
|
||||
hljs.registerLanguage("python", python)
|
||||
hljs.registerLanguage("javascript", javascript)
|
||||
hljs.registerLanguage("go", go)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
@@ -88,10 +88,6 @@ const difficultyOptions: SelectOption[] = [
|
||||
const languageOptions = [
|
||||
{ label: LANGUAGE_SHOW_VALUE["C"], value: "C" },
|
||||
{ label: LANGUAGE_SHOW_VALUE["Python3"], value: "Python3" },
|
||||
{ label: LANGUAGE_SHOW_VALUE["C++"], value: "C++" },
|
||||
{ label: LANGUAGE_SHOW_VALUE["Java"], value: "Java" },
|
||||
{ label: LANGUAGE_SHOW_VALUE["JavaScript"], value: "JavaScript" },
|
||||
{ label: LANGUAGE_SHOW_VALUE["Golang"], value: "Golang" },
|
||||
]
|
||||
|
||||
const tagOptions = computed(() =>
|
||||
@@ -461,7 +457,7 @@ watch([fromExistingTags, newTags], (tags) => {
|
||||
</template>
|
||||
</n-alert>
|
||||
<n-space justify="space-between">
|
||||
<n-form inline label-placement="left">
|
||||
<n-form inline label-placement="left" :show-feedback="false">
|
||||
<n-form-item label="语言">
|
||||
<n-checkbox-group v-model:value="problem.languages">
|
||||
<n-space align="center">
|
||||
|
||||
@@ -248,10 +248,10 @@ const columns = computed(() => {
|
||||
<n-input clearable @change="search" />
|
||||
</n-form-item>
|
||||
<n-form-item>
|
||||
<n-space>
|
||||
<n-button @click="search(query.username)">搜索</n-button>
|
||||
<n-button @click="clear">重置</n-button>
|
||||
</n-space>
|
||||
<n-button @click="search(query.username)">搜索</n-button>
|
||||
</n-form-item>
|
||||
<n-form-item>
|
||||
<n-button @click="clear">重置</n-button>
|
||||
</n-form-item>
|
||||
</n-form>
|
||||
</n-space>
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
import { Codemirror } from "vue-codemirror"
|
||||
import { cpp } from "@codemirror/lang-cpp"
|
||||
import { python } from "@codemirror/lang-python"
|
||||
import { java } from "@codemirror/lang-java"
|
||||
import { javascript } from "@codemirror/lang-javascript"
|
||||
import { EditorView } from "@codemirror/view"
|
||||
import { oneDark } from "./themes/oneDark"
|
||||
import { smoothy } from "./themes/smoothy"
|
||||
@@ -42,10 +40,10 @@ watch(
|
||||
const emit = defineEmits(["update:modelValue"])
|
||||
|
||||
const lang = computed(() => {
|
||||
if (props.language === "C" || props.language === "C++") return cpp()
|
||||
if (props.language === "Java") return java()
|
||||
if (props.language === "JavaScript") return javascript()
|
||||
return python()
|
||||
if (props.language === "Python3" || props.language === "Python2") {
|
||||
return python()
|
||||
}
|
||||
return cpp()
|
||||
})
|
||||
|
||||
function onChange(v: string) {
|
||||
|
||||
Reference in New Issue
Block a user