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