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>

效果展示

相关推荐
Android洋芋16 分钟前
Android的资源管理规范
前端
深呼吸99323 分钟前
如何用div手写一个富文本编辑器(contenteditable="true")
前端·vue.js
小赵学鸿蒙39 分钟前
CodeGenie 工具功能汇总
前端
叫一只猪40 分钟前
基于Antd+Dumi搭建组件库
前端·前端框架
LovelyAqaurius42 分钟前
WebGL详解Part2:着色器的奥秘
前端
断竿散人43 分钟前
彻底吃透CSS盒模型:从布局坍塌到精准控制!
前端·css
小赵学鸿蒙44 分钟前
DevEco Studio 安装与使用全流程
前端
踢足球的,程序猿1 小时前
WebAssembly的本质与核心价值
前端·javascript·前端框架·wasm·webassembly
子非鱼3731 小时前
JS树形结构与列表结构之间的相互转换
前端
嘉小华1 小时前
大白话讲解 Android LayoutInflater
前端