Files
Yi.Admin/Yi.BBS.Vue3/src/components/MavonEdit.vue
2023-03-12 01:50:11 +08:00

46 lines
890 B
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<template>
<mavon-editor
:v-model="text"
:subfield="subfield"
:codeStyle="props.codeStyle"
:ishljs="true"
:style="{minHeight:props.height,maxHeight:'100%'}"
class="edit"
@change="change"
></mavon-editor>
</template>
<script setup>
// Local Registration
import { mavonEditor } from 'mavon-editor'
import 'mavon-editor/dist/css/index.css'
import { ref,computed,watch } from 'vue';
const props = defineProps(['height','modelValue',"codeStyle"])
const emit=defineEmits(['update:modelValue'])
const subfield = true;
//v-model传值出去
const text = computed({
get() {
return props.modelValue
},
set(value) {
emit('update:modelValue', value)
}
})
const change=(value ,render)=>
{
console.log(value,"value");
//不用给解析后htm的值给value即可
emit('update:modelValue', value)
}
</script>
<style scoped>
.edit
{
width: 100%;
}
</style>