This commit is contained in:
2024-01-23 11:05:18 +08:00
parent d5cadf954f
commit 434c4497a9

View File

@@ -56,33 +56,31 @@ function onChange(v: string) {
} }
</script> </script>
<template> <template>
<div class="container"> <n-flex align="center" class="header">
<n-flex align="center" class="title"> <span class="title">{{ label }}</span>
<span>{{ label }}</span> <slot name="actions"></slot>
<slot name="actions"></slot> </n-flex>
</n-flex> <Codemirror
<Codemirror v-model="code"
v-model="code" indentWithTab
indentWithTab :extensions="[styleTheme, lang, isDark ? oneDark : smoothy]"
:extensions="[styleTheme, lang, isDark ? oneDark : smoothy]" :disabled="props.readonly"
:disabled="props.readonly" :tabSize="4"
:tabSize="4" :placeholder="props.placeholder"
:placeholder="props.placeholder" :style="{
:style="{ height: '100%', fontSize: props.fontSize + 'px' }" height: 'calc(100% - 60px)',
@change="onChange" fontSize: props.fontSize + 'px',
/> }"
</div> @change="onChange"
/>
</template> </template>
<style scoped> <style scoped>
.container { .header {
height: 100%;
}
.title {
padding: 12px 20px; padding: 12px 20px;
height: 60px; height: 60px;
box-sizing: border-box; box-sizing: border-box;
} }
.title > span { .title {
font-size: 16px; font-size: 16px;
} }
</style> </style>