<style>
  .diy-image-text {
    width: 100%;
    height: 500px;
    overflow: hidden;
    overflow-y: auto;
  }

  .imgVisible {
    visibility: hidden;
  }

  .visibleA {
    visibility: visible;
  }

</style>
<template>
  <div :class="{'active':imageData.isCked}">
    <div class="diy-component-options" v-if="imageData.isCked">
      <el-button type="primary" icon="el-icon-delete" style="left: -25px; top: 0px;" @click="delPlugin()"></el-button>
      <el-button type="primary" icon="el-icon-document-copy" style="left: -25px; top: 30px;"></el-button>
      <el-button type="primary" icon="el-icon-arrow-up" v-if="index>0" @click="resetSord(0)"
        style="right: -25px; top: 0;"></el-button>
      <el-button type="primary" icon="el-icon-arrow-down" v-if="index!=dataLeng-1" @click="resetSord(1)"
        style="right: -25px; top: 30px;"></el-button>
    </div>
    <div class="diy-modal">
      <div class="diy-component-preview">
        <div class="diy-image-text">
          <div v-if="data.content" v-html="data.content"></div>
          <div v-else flex="main:center" style="line-height: 500px;color: rgb(173, 177, 184);">图文详情</div>
        </div>
      </div>
      <div class="diy-component-edit imgVisible" :class="{'visibleA':imageData.isCked}">
        <UE :defaultMsg="defaultMsg" :config="config" ref="ue" @input="input"></UE>
      </div>
    </div>
  </div>
</template>
<script>
  import UE from '@/components/global/UE.vue'
  export default {
    props: ["imageData", "index", "dataLeng"],
    components: {
      UE
    },
    data() {
      return {
        data: this.imageData.data,
        defaultMsg: '',
        config: {
          initialFrameWidth: null,
          initialFrameHeight: 350,
        },
        content: ''
      };
    },
    created() {},
    methods: {
      //向父组件传值 并调用排序
      resetSord(IsUp) {
          console.log(IsUp);
        this.$emit('getSord', this.index, IsUp);
      },
      //点击触发父组件删除
      delPlugin() {
        this.$emit('comDelPlugin', this.index);
      },
      input(obj) {
        this.data.content = obj
      },
    },
    computed: {},
    mounted() {
      this.$refs.ue.InitData();
    },
    watch: {
      defaultMsg: {
        handler(newVal, oldVal) {
        },
        deep: true
      }
    }
  };

</script>
