Giter Club home page Giter Club logo

v-umeditor's Introduction

v-umeditor

UMeditor(ueditor的mini版) 1.2.3 的Vue版本。 加入自定义UI,适应现代风格

完整DEMO

代码DEMO

安装

npm i v-umeditor -S

yarn add v-umeditor

全局引用

import vUeditor from 'v-umeditor'

Vue.use(vUeditor)

在组件内引用

import { vUeditor } from 'v-umeditor'

components: {
  vUeditor
}

使用

<v-ueditor
  :config="config"
  @ready="ueditorReady"
></v-ueditor>

注: 开启vue keep-alive时,当使用ready参数保存返回的编辑器实例,当第二次进入页面时,通过返回实例获取内容报错。建议使用window.UM.getEditor(id)方式获取实例

props

字段 必填 类型 默认值 描述
id String 当前编辑器 id
content String 初始化数据内容
config Object {} 配置参数,详细参考 https://github.com/JakeLaoyu/v-umeditor/blob/master/static/umeditor.config.js
newstyle Boolean true 是否使用新样式
useCustomUpload Boolean false 是否使用 自定义文件上传

Events

字段 描述 return
ready UEditor初始化后返回UEditor实例对象,可以调用实例方法,文档: http://ueditor.baidu.com/doc/#UE.Editor UE实例
change 监听UEditor内容改变,返回UEditor实例对象,可以调用实例方法,文档: http://ueditor.baidu.com/doc/#UE.Editor UE实例

注: 目前发现contentchange事件在选中删除时不触发,建议同时监听contentchangeselectionchange事件,使用window.UM.getEditor(id).getContent()获取内容

或者

// 获取实例
window.UM.getEditor(id)

图片上传

官方配置

请参考官方DEMO文档,需要后端配合 https://ueditor.baidu.com/website/download.html#mini

ajax异步上传

需要开启useCustomUpload配置

使用formDate格式上传,服务端返回格式:

{
  message: 'SUCCESS',
  url: 'xxx'
}

v-umeditor's People

Contributors

jakelaoyu avatar dependabot[bot] avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.