UnisKB/ui/src/components/codemirror-editor/index.vue

28 lines
560 B
Vue
Raw Normal View History

2024-08-15 09:17:25 +00:00
<template>
<Codemirror v-bind="$attrs" border :options="cmOption" ref="cmRef" :style="codemirrorStyle" />
2024-08-15 09:17:25 +00:00
</template>
<script setup lang="ts">
import { ref, onMounted, onUnmounted } from 'vue'
import { Codemirror } from 'vue-codemirror'
2024-08-15 09:17:25 +00:00
defineOptions({ name: 'CodemirrorEditor' })
const cmOption = {
tabSize: 4,
lineWrapping: true,
lineNumbers: true,
line: true
2024-08-15 09:17:25 +00:00
}
const codemirrorStyle = {
height: '210px!important'
}
const cmRef = ref()
onMounted(() => {})
onUnmounted(() => {
cmRef.value?.destroy()
})
2024-08-15 09:17:25 +00:00
</script>
<style lang="scss"></style>