javascript - 求推荐vue2上可用的富文本插件

查看:103
本文介绍了javascript - 求推荐vue2上可用的富文本插件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问 题

如题,在git上找了很久vue2的富文本编辑插件但是一直未找到 所以想问一下有没有用过相关插件的朋友~~求推荐

这个问题已被关闭,原因:问题已解决 - 问题已解决,且对他人无借鉴意义

解决方案

我试了试,也可以在vue里使用类似ueditor这类的编辑器,以vue-cli生成的项目为例

index.html

    <script type="text/javascript" charset="utf-8" src="http://127.0.0.1/vue/static/utf8-php/ueditor.config.js"></script>
    <script type="text/javascript" charset="utf-8" src="http://127.0.0.1/vue/static/utf8-php/ueditor.all.min.js"> </script>

webpack.base.cong.js

  externals: {
    'UE': 'UE',
  },

editor组件

<template>
  <div>
    <mt-button @click="geteditor()" type="danger">获取</mt-button>
    <script id="editor" type="text/plain" style="width:1024px;height:500px;"></script>
  </div>
</template>

<script>
const UE = require('UE');// eslint-disable-line

export default {
  name: 'editorView',
  data: () => (
    {
      editor: null,
    }
  ),
  methods: {
    geteditor() {
      console.log(this.editor.getContent());
    },
  },
  mounted() {
    this.editor = UE.getEditor('editor');
  },
  destroyed() {
    this.editor.destroy();
  },
};
</script>

<style>

</style>

这篇关于javascript - 求推荐vue2上可用的富文本插件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆