mirror of
https://github.com/Tencent/tmagic-editor.git
synced 2025-12-10 18:02:53 +00:00
36 lines
683 B
Vue
36 lines
683 B
Vue
<template>
|
|
<MagicCodeEditor
|
|
:height="config.height"
|
|
:init-values="model[name]"
|
|
:language="config.language"
|
|
:options="{
|
|
...config.options,
|
|
readOnly: disabled,
|
|
}"
|
|
:parse="config.parse"
|
|
@save="save"
|
|
></MagicCodeEditor>
|
|
</template>
|
|
|
|
<script lang="ts" setup>
|
|
import type { CodeConfig, FieldProps } from '@tmagic/form';
|
|
|
|
import MagicCodeEditor from '@editor/layouts/CodeEditor.vue';
|
|
|
|
defineOptions({
|
|
name: 'MFieldsVsCode',
|
|
});
|
|
|
|
const emit = defineEmits<{
|
|
change: [value: string | any];
|
|
}>();
|
|
|
|
withDefaults(defineProps<FieldProps<CodeConfig>>(), {
|
|
disabled: false,
|
|
});
|
|
|
|
const save = (v: string | any) => {
|
|
emit('change', v);
|
|
};
|
|
</script>
|