|
@@ -8,6 +8,7 @@
|
|
import { useAppStore } from '/@/store/modules/app';
|
|
import { useAppStore } from '/@/store/modules/app';
|
|
import { useWindowSizeFn } from '/@/hooks/event/useWindowSizeFn';
|
|
import { useWindowSizeFn } from '/@/hooks/event/useWindowSizeFn';
|
|
import CodeMirror from 'codemirror';
|
|
import CodeMirror from 'codemirror';
|
|
|
|
+ import { MODE } from './../typing';
|
|
// css
|
|
// css
|
|
import './codemirror.css';
|
|
import './codemirror.css';
|
|
import 'codemirror/theme/idea.css';
|
|
import 'codemirror/theme/idea.css';
|
|
@@ -18,7 +19,14 @@
|
|
import 'codemirror/mode/htmlmixed/htmlmixed';
|
|
import 'codemirror/mode/htmlmixed/htmlmixed';
|
|
|
|
|
|
const props = defineProps({
|
|
const props = defineProps({
|
|
- mode: { type: String, default: 'application/json' },
|
|
|
|
|
|
+ mode: {
|
|
|
|
+ type: String as PropType<MODE>,
|
|
|
|
+ default: MODE.JSON,
|
|
|
|
+ validator(value: any) {
|
|
|
|
+ // 这个值必须匹配下列字符串中的一个
|
|
|
|
+ return Object.values(MODE).includes(value);
|
|
|
|
+ },
|
|
|
|
+ },
|
|
value: { type: String, default: '' },
|
|
value: { type: String, default: '' },
|
|
readonly: { type: Boolean, default: false },
|
|
readonly: { type: Boolean, default: false },
|
|
});
|
|
});
|