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>

效果展示

相关推荐
努力学习的少女25 分钟前
对SparkRDD的认识
开发语言·前端·javascript
LYFlied29 分钟前
Webpack 深度解析:从原理到工程实践
前端·面试·webpack·vite·编译原理·打包·工程化
苏打水com1 小时前
第十二篇:Day34-36 前端工程化进阶——从“单人开发”到“团队协作”(对标职场“大型项目协作”需求)
前端·javascript·css·vue.js·html
知了清语1 小时前
为天地图 JavaScript API v4.0 提供 TypeScript 类型支持 —— tianditu-v4-types 正式发布!
前端
程序员Sunday1 小时前
为什么 AI 明明写后端更爽,但却都网传 AI 取代前端,而不是 AI 取代后端?就离谱...
前端·后端
之恒君1 小时前
React 性能优化(方向)
前端·react.js
钝挫力PROGRAMER1 小时前
Vue中选项式和组合式API的学习
javascript·vue.js
3秒一个大1 小时前
Vue 任务清单开发:数据驱动 vs 传统 DOM 操作
前端·javascript·vue.js
an86950011 小时前
vue自定义组件this.$emit(“refresh“);
前端·javascript·vue.js
Avicli1 小时前
Gemini3 生成的基于手势控制3D粒子圣诞树
前端·javascript·3d