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>

效果展示

相关推荐
你怎么知道我是队长6 小时前
前端学习---HTML---标签属性
前端·学习·html
LawrenceLan6 小时前
30.Flutter 零基础入门(三十):GridView 网格布局 —— 九宫格与商品列表必学
开发语言·前端·flutter·dart
汐瀼6 小时前
【AI个人学习】npm本地安装claude code白嫖minimax模型
前端·学习·npm
小岛前端6 小时前
从 Vite 到 Vize:Vue 开发体验的下一次飞跃
前端·vue.js
芝士雪豹只抽瑞克五6 小时前
Tomcat Web应用服务器笔记
前端·笔记·tomcat
阿珊和她的猫6 小时前
实现网页锚点功能的技术指南
前端·javascript·vue.js·状态模式
这波不该贪内存的6 小时前
Linux文件编程:流与操作全解析
java·服务器·前端
归叶再无青6 小时前
企业级web服务(Tomcat开源web应用服务器)
运维·前端·开源·tomcat·bash
花生柿子6 小时前
在elementui可横向滚动的table中,操作列有时候会透视下面的行
前端·javascript·elementui
RunsenLIu6 小时前
基于 Spring Boot 3 与 Vue 3 的汽车租赁系统
vue.js·spring boot·汽车