add playground.

This commit is contained in:
2023-05-04 11:28:48 +08:00
parent b7f48ccd28
commit 4aa70f22ed
5 changed files with 340 additions and 170 deletions

View File

@@ -22,12 +22,14 @@ interface Props {
language?: LANGUAGE
fontSize?: number
height?: string
readonly?: boolean
}
const props = withDefaults(defineProps<Props>(), {
language: "C",
fontSize: 20,
height: "100%",
readonly: false,
})
const code = ref(props.modelValue)
@@ -55,11 +57,9 @@ function onChange(v: string) {
v-model="code"
:extensions="[styleTheme, lang, isDark ? oneDark : smoothy]"
indentWithTab
:disabled="props.readonly"
:tabSize="4"
@change="onChange"
:style="{
height: props.height,
fontSize: props.fontSize + 'px',
}"
:style="{ height: props.height, fontSize: props.fontSize + 'px' }"
/>
</template>

View File

@@ -59,6 +59,15 @@ const menus = computed<MenuOption[]>(() => [
show: userStore.isAdminRole,
key: "admin",
},
{
label: () =>
h(
RouterLink,
{ to: "/play", target: "_blank" },
{ default: () => "自测" }
),
key: "play",
},
])
const options: Array<DropdownOption | DropdownDividerOption> = [