<!-- editpublic -->
<template>
  <view class="editpublic">
    <view class="container">
      <editor
        id="editor"
        class="ql-container"
        :placeholder="placeholder"
        @ready="onEditorReady"
      ></editor>
      <editor-parse :contents="content"></editor-parse>
    </view>
  </view>
</template>

<script>

export default {
  name: 'editpublic',
  components: {},
  data () {
    //这里存放数据
    return {
      placeholder: '开始输入...',
      content: '赋值内容'
    };
  },
  //监控data中的数据变化
  watch: {},
  //方法集合
  methods: {
    onEditorReady () {
      uni.createSelectorQuery().select('#editor').context((res) => {
        this.editorCtx = res.context
      }).exec()
    },
    undo () {
      this.editorCtx.undo()
    }

  },
}
</script>
<style lang='scss' scoped>
.editpublic {
  padding: 20upx 33upx 0;
  .container {
    padding: 10px;
  }

  #editor {
    width: 100%;
    height: 300px;
    background-color: #cccccc;
  }
}
</style>