vue的markdown编辑器插件比对

vue的markdown编辑器插件比对

文章说明

文章比对 md-editor-v3、vditor 这两个插件的使用及效果体验

md-editor-v3的使用及效果展示

安装

powershell 复制代码
npm install md-editor-v3

使用

html 复制代码
<script setup>
import {reactive} from "vue";
import {MdEditor} from 'md-editor-v3';
import 'md-editor-v3/lib/style.css';

const data = reactive({
  text: "",
});
</script>

<template>
  <MdEditor toolbarsExclude="['github']" v-model="data.text" style="height: 100vh; width: 100vw"/>
</template>

<style>
* {
  padding: 0;
  margin: 0;
  box-sizing: border-box;
}
</style>

效果展示

附注说明:直接使用vue3,vue@cli运行项目会报错,需要在babel.config.js里面加上内容 plugins: ["@babel/plugin-transform-private-methods"]

javascript 复制代码
module.exports = {
    presets: [
        '@vue/cli-plugin-babel/preset'
    ],
    plugins: ["@babel/plugin-transform-private-methods"]
}

vditor的使用及效果展示

安装

powershell 复制代码
npm i vditor --save

使用

html 复制代码
<script setup>
import Vditor from 'vditor'
import 'vditor/dist/index.css';
import {onMounted, ref} from 'vue';

const vditor = ref()

onMounted(() => {
  vditor.value = new Vditor('vditor', {
    height: '100vh',
    width: '100vw'
  });
});
</script>

<template>
  <div id="vditor"></div>
</template>

<style>
* {
  padding: 0;
  margin: 0;
  box-sizing: border-box;
}
</style>

效果展示

相关推荐
Never_Satisfied4 小时前
在HTML & CSS中,可能导致父元素无法根据子元素的尺寸自动调整大小的情况
前端·css·html
We་ct4 小时前
LeetCode 101. 对称二叉树:两种解法(递归+迭代)详解
前端·算法·leetcode·链表·typescript
lyyl啊辉4 小时前
6. Vue开源三方UI组件库
vue.js
码云数智-大飞4 小时前
微前端架构落地实战:qiankun vs Module Federation 2026 深度对比与选型指南
前端·架构
IT枫斗者4 小时前
MyBatis批量插入性能优化:从5分钟到3秒的工程化实践
前端·vue.js·mysql·mongodb·性能优化·mybatis
前端 贾公子5 小时前
深入理解 Vue3 的 v-model 及自定义指令的实现原理(中)
前端·html
yuezhilangniao5 小时前
【AI 编辑器开发规范 v2.1 版】—— 为 AI 时代的敏捷开发而生
人工智能·编辑器·敏捷流程
Never_Satisfied5 小时前
在HTML & CSS中,img标签固定宽度时,img和图片保持比例缩放
前端·css·html
Cache技术分享5 小时前
327. Java Stream API - 实现 joining() 收集器:从简单到进阶
前端·后端
人工智能先锋5 小时前
从零部署你的24小时AI管家:OpenClaw完整实战指南(附踩坑记录)
前端·github