Skip to content

Commit 6af2697

Browse files
phk422sxzz
authored andcommitted
feat: improve code
1 parent ac13a01 commit 6af2697

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/codemirror/CodeMirror.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
<script setup lang="ts">
66
import type { ModeSpec, ModeSpecOptions } from 'codemirror'
7-
import { inject, onMounted, ref, watch, watchEffect } from 'vue'
7+
import { type Ref, inject, onMounted, ref, watch, watchEffect } from 'vue'
88
import { debounce } from '../utils'
99
import CodeMirror from './codemirror'
1010
@@ -24,7 +24,7 @@ const emit = defineEmits<(e: 'change', value: string) => void>()
2424
2525
const el = ref<HTMLDivElement>()
2626
const needAutoResize = inject('autoresize')
27-
const autoSave = inject<boolean>('autosave')
27+
const autoSave = inject<Ref<boolean>>('autosave')!
2828
2929
onMounted(() => {
3030
const addonOptions = props.readonly
@@ -82,7 +82,7 @@ onMounted(() => {
8282
}
8383
8484
watch(
85-
() => autoSave,
85+
autoSave,
8686
(newVal) => {
8787
if (newVal) {
8888
el.value!.removeEventListener('keydown', saveKeydownEvent)

0 commit comments

Comments
 (0)