feat: 代码编辑器

This commit is contained in:
wang_fan_w 2024-06-05 00:05:39 +08:00
parent caf400f9d3
commit 2f11c433fd
2 changed files with 7 additions and 21 deletions

View File

@ -1,28 +1,20 @@
<template>
<div class="main">
<code-mirror basic :lang="lang" v-model="codeVal" style="height: 400px" :theme="theme" :extensions="extensions" />
</div>
<code-mirror basic :lang="lang" v-model="codeVal" :theme="theme" :extensions="extensions" />
</template>
<script setup lang="ts">
import CodeMirror from "vue-codemirror6";
import { oneDark } from '@codemirror/theme-one-dark'
import { oneDark } from "@codemirror/theme-one-dark";
import { json } from "@codemirror/lang-json";
defineOptions({ name: "CodemirrorCode" });
const props = defineProps({
initJson: {
type: Object,
default: () => {}
default: {}
}
});
// const initJson = {
// name: `maybaby`,
// year: 25,
// weight: 45,
// height: 165
// };
//
let codeVal = ref("");
// json
@ -54,13 +46,4 @@ const theme = {
};
</script>
<style lang="scss" scoped>
.main {
width: 100%;
height: 100%;
}
/* required! */
.cm-editor {
height: 100%;
}
</style>
<style lang="scss" scoped></style>

3
src/vite-env.d.ts vendored
View File

@ -8,3 +8,6 @@ declare module "*.vue" {
declare module "vue-i18n";
declare module "@arco-design/color";
declare module "sortablejs";
declare module "vue-codemirror6";
declare module "@codemirror/theme-one-dark";
declare module "@codemirror/lang-json";