add language icons

This commit is contained in:
2024-06-27 06:34:00 +00:00
parent a81aea740b
commit dc8e767d0f
3 changed files with 23 additions and 4 deletions

View File

@@ -1,11 +1,28 @@
<script lang="ts" setup>
import { code } from "../composables/code"
import type { SelectOption } from "naive-ui"
import { h } from "vue"
const languages: SelectOption[] = [
{ value: "python", label: "Python" },
{ value: "c", label: "C" },
const LANGS = [
["python", "Python"],
["c", "C 语言"],
]
const languages: SelectOption[] = LANGS.map((it) => ({
value: it[0],
label: () => [
h("img", {
src: `/${it[0]}.svg`,
style: {
width: "16px",
height: "16px",
marginRight: "8px",
transform: "translateY(3px)",
},
}),
it[1],
],
}))
</script>
<template>
<n-select
@@ -17,6 +34,6 @@ const languages: SelectOption[] = [
</template>
<style scoped>
.select {
width: 100px;
width: 120px;
}
</style>