Home

Awesome

yimo-vue-editor

Demo address: https://vue-editor.yimo.link/example/html/index.html

Vue-editor component based on wangeditor2.5.11 wrapper wangEditor docs:https://www.kancloud.cn/wangfupeng/wangeditor2/113961

Used in vue projects

npm install yimo-vue-editor --save

<template>
  <yimo-vue-editor v-model="text"></yimo-vue-editor>
</template>

import YimoVueEditor from 'yimo-vue-editor'
export default {
  components: {
    YimoVueEditor
  }
}

Global introduction and configuration

import YimoVueEditor from 'yimo-vue-editor'

Vue.use(YimoVueEditor, {
  name: 'v-editor-app',//Custom name
  config: {
    uploadImgUrl:'/api/upload', // upload api
    printLog: false, // disabled console.log
    useLang: 'en' // lang config
  },//wagnEditor config
  uploadHandler: (type, resTxt) => {//Upload processing hook
    if (type === 'success') {
      var res = JSON.parse(resTxt)//Do not process the default look at the return value bit image path
      if (res.status !== 1) {
        return null
      }
      return res.data
    } else if (type === 'error') {
      //todo toast
    } else if (type === 'timeout') {
      //todo toast
    }
    return 'upload failed__'
  }
})

Parameter

Modification

Points to pay attention to