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>

效果展示

相关推荐
烛阴5 分钟前
JavaScript 的 8 大“阴间陷阱”,你绝对踩过!99% 程序员崩溃瞬间
前端·javascript·面试
偶尔微微一笑19 分钟前
AI网络渗透kali应用(gptshell)
linux·人工智能·python·自然语言处理·编辑器
lh_125436 分钟前
ECharts 地图开发入门
前端·javascript·echarts
jjw_zyfx38 分钟前
成熟的前端vue vite websocket,Django后端实现方案包含主动断开websocket连接的实现
前端·vue.js·websocket
timing9941 小时前
LVGL在VScode的WSL2中仿真
ide·vscode·编辑器
Mikey_n1 小时前
前台调用接口的方式及速率对比
前端
周之鸥1 小时前
使用 Electron 打包可执行文件和资源:完整实战教程
前端·javascript·electron
我爱吃朱肉1 小时前
HTMLCSS模板实现水滴动画效果
前端·css·css3
机器视觉知识推荐、就业指导2 小时前
开源QML控件:进度条滑动控件(含源码下载链接)
前端·qt·开源·qml
前端snow2 小时前
前端全栈第二课:用typeorm向数据库添加数据---一对多关系
前端·javascript