<template>
    <div id="cover"></div>
</template>

<script>
import E from 'wangeditor'
var phoneEditor, _this
export default {
  components: {},
  props: {
    coverVal: {
      type: String,
      required: false
    }
  },
  data () {
    return {}
  },
  created () {},
  mounted () {
    _this = this
    phoneEditor = new E('cover')
    phoneEditor.onchange = function () {
      _this.$emit('cover', this.$txt.html())
    }

    phoneEditor.create()
    // phoneEditor.$txt.html(this.val)
  },
  methods: {},
  computed: {},
  watch: {
    coverVal (val) {
      // console.log(val)
      phoneEditor.$txt.html(_this.coverVal)
    }
  }
}
</script>

<style lang="scss" scoped>
#cover {
  width: 100%;
  height: 250px;
}
</style>
