vue3引入vditor插件正确使用方法
首先安装vditornpm install vditor --save在组件中使用<template><div id="vditor"></div></template><script setup>import { defineProps, ref, onMounted } from "vue";import Vditor from "v
·
首先安装vditor
npm install vditor --save
在组件中使用
<template>
<div id="vditor"></div>
</template>
<script setup>
import { defineProps, ref, onMounted } from "vue";
import Vditor from "vditor";
import "vditor/dist/index.css";
const contentEditor = ref("");
onMounted(() => {
contentEditor.value = new Vditor("vditor", {
height: 360,
toolbarConfig: {
pin: true,
},
cache: {
enable: false,
},
after: () => {
contentEditor.value.setValue("hello,Vditor+Vue!");
},
});
});
</script>
<style scoped>
a {
color: #42b983;
}
</style>
更多推荐
已为社区贡献4条内容
所有评论(0)