<sr-codemirror
class="codemirror"
:codemirror-Option="cmOption"
:codemirror-Model="cmModel"
@codemirrorChange="changeText"
:codemirrorPlaceholder="'请输入'"
></sr-codemirror>
<script lang="ts">
import { defineComponent, reactive, toRefs, ref, computed } from 'vue';
import srCodemirror from '@/components/sr-codemirror/index.vue';
export default defineComponent({
setup() {
const cmOption = reactive({
lineNumbers: true,
extraKeys: {'Ctrl': 'autocomplete'},
mode: {name: 'text/x-sql'},
indentUnit: 2, // 缩进单位,默认2
smartIndent: true, // 是否智能缩进
tabSize: 4, // Tab缩进,默认4
// 软换行
lineWrapping: true, // 代码折叠
styleActiveLine: true, // 当前背景行高亮
matchBrackets:true, // 括号匹配
// showCursor