textBox.vue 1.09 KB
<template>
  <div>
    <div id="div-demo"></div>
  </div>
</template>

<script>
import E from 'wangeditor'
export default {
  name: 'textBox',
  data() {
    return {
      content: '', 
      editorOption: {},
    }
  },
  mounted() {
    this.getEdit()
  },
  methods: {
    getEdit() {
      var editor = new E('#div-demo')
      editor.config.uploadImgShowBase64 = true
      editor.config.showMenuTooltips = true
      editor.config.menuTooltipPosition = 'down'
      editor.config.height = 400
      editor.config.width = 500
      editor.config.uploadVideoServer = '/api/upload-video'
      editor.config.excludeMenus = ['code']
      editor.config.onchange = (html) => {
        // console.log(html);
        this.content = html // 绑定当前逐渐地值
        this.$emit('change', this.content) // 将内容同步到父组件中
      }
      editor.config.onchangeTimeout = 5000;
      editor.create()
    }
  }
}
</script>

<style lang="scss" scoped>
#div-demo {
  margin: 16px 300px 0 0;
}
.el-form .editor{
    margin-top: 20px;
}
.myQuillEditor {
  background-color: #fff;
  height: 200px;
}
</style>