mirror of
https://github.com/Megghy/vtsuru.live.git
synced 2025-12-08 11:26:56 +08:00
fix: no voice in speech page; custom personal page redirect notworking. feat: sync sroll bar between question display page an obs component
This commit is contained in:
32
src/components/MonacoEditorComponent.vue
Normal file
32
src/components/MonacoEditorComponent.vue
Normal file
@@ -0,0 +1,32 @@
|
||||
<template>
|
||||
<div ref="editorContainer" :style="`height: ${height}px;`"></div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { editor } from 'monaco-editor'; // 全部导入
|
||||
import { ref, onMounted } from 'vue';
|
||||
|
||||
const value = defineModel<string>('value')
|
||||
|
||||
const { language, height = 400 } = defineProps<{
|
||||
language: string
|
||||
height?: number
|
||||
}>()
|
||||
|
||||
const editorContainer = ref()
|
||||
|
||||
onMounted(() => {
|
||||
const e = editor.create(editorContainer.value, {
|
||||
value: value.value,
|
||||
language: language,
|
||||
minimap: {
|
||||
enabled: true
|
||||
},
|
||||
colorDecorators: true,
|
||||
automaticLayout: true
|
||||
})
|
||||
e.onDidChangeModelContent(() => {
|
||||
value.value = e.getValue()
|
||||
})
|
||||
})
|
||||
</script>
|
||||
Reference in New Issue
Block a user