<style>
  .diy-live .room-box {
    display: flex;
    flex-direction: column;
  }

  .diy-live .room-box .label {
    color: #999999;
  }

  /*样式一*/
  .diy-live .style-box-1 {
    background: #ffffff;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 0 10px 5px rgba(0, 0, 0, 0.1);
  }

  .diy-live .style-box-1 .item {
    height: 360px;
    background: #999999;
    border-radius: 16px;
    position: relative;
    overflow: hidden;
  }

  .diy-live .style-box-1 .label-box {
    border-top-left-radius: 16px;
    border-top-right-radius: 30px;
    border-bottom-right-radius: 30px;
    position: absolute;
    top: 0;
    left: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
  }

  .diy-live .style-box-1 .text-time {
    color: #ffffff;
    font-size: 24px;
    margin: 0 20px;
  }

  .diy-live .style-box-1 .label-box-item {
    background: #22ac38;
    border-top-right-radius: 30px;
    border-bottom-right-radius: 30px;
    display: flex;
    align-items: center;
    padding: 12px 20px;
  }

  .diy-live .style-box-1 .icon {
    width: 10px;
    height: 10px;
    background: #ffffff;
    border-radius: 50%;
  }

  .diy-live .style-box-1 .text {
    color: #ffffff;
    font-size: 24px;
    margin-left: 12px;
  }

  .diy-live .style-box-1 .user-info-box {
    position: absolute;
    bottom: 0;
    left: 0;
    display: flex;
    align-items: center;
    margin: 20px;
  }

  .diy-live .style-box-1 .avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #ffffff;
  }

  .diy-live .style-box-1 .nickname {
    width: 578px;
    margin-left: 12px;
    font-size: 24px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #ffffff;
  }

  .diy-live .style-box-1 .title {
    width: 645px;
    font-size: 32px;
    color: #353535;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin: 28px 0 20px;
  }

  .diy-live .style-box-1 .goods-box {
    display: flex;
    align-items: center;
    padding: 10px;
    background: #f7f7f7;
    border-radius: 16px;
  }

  .diy-live .style-box-1 .goods-cover {
    border-radius: 8px;
    width: 80px;
    height: 80px;
    background: #999999;
  }

  .diy-live .style-box-1 .goods-item {
    display: flex;
    flex-direction: column;
    margin-left: 16px;
  }

  .diy-live .style-box-1 .goods-name {
    width: 540px;
    font-size: 26px;
    color: #666666;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .diy-live .style-box-1 .goods-price {
    margin-top: 16px;
  }

  /*样式二*/

  .diy-live .style-box-2 {
    width: 100%;
    display: flex;
    justify-content: space-between;
  }

  .diy-live .style-box-2 .item {
    background: #ffffff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 0 10px 5px rgba(0, 0, 0, 0.1);
  }

  .diy-live .style-box-2 .live-img-box {
    border-radius: 16px;
    overflow: hidden;
    position: relative;
  }

  .diy-live .style-box-2 .live-img {
    width: 346px;
    height: 346px;
    background: #999999;
  }

  .diy-live .style-box-2 .label-box-item {
    width: 100%;
    border-top-right-radius: 24px;
    border-bottom-right-radius: 24px;
    position: absolute;
    top: 0;
    left: 0;
    background: rgba(0, 0, 0, 0.5);
  }

  .diy-live .style-box-2 .label-box {
    padding: 12px 20px;
    border-top-right-radius: 30px;
    border-bottom-right-radius: 30px;
    background: #777777;
    position: absolute;
    top: 0;
    left: 0;
    display: flex;
    align-items: center;
  }

  .diy-live .style-box-2 .icon {
    width: 10px;
    height: 10px;
    background: #ffffff;
    border-radius: 50%;
  }

  .diy-live .style-box-2 .text {
    color: #ffffff;
    font-size: 24px;
    margin-left: 12px;
  }

  .diy-live .style-box-2 .user-info {
    position: absolute;
    bottom: 0;
    left: 0;
    margin: 20px;
    display: flex;
    justify-content: center;
  }

  .diy-live .style-box-2 .avatar {
    width: 40px;
    height: 40px;
    background: #ffffff;
    border-radius: 50%;
  }

  .diy-live .style-box-2 .nickname {
    margin-left: 12px;
    font-size: 24px;
    width: 194px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #ffffff;
  }

  .diy-live .style-box-2 .title {
    font-size: 28px;
    color: #353535;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin: 28px;
    width: 290px;
  }

  .diy-live .style-box-2 .goods-box {
    display: flex;
    margin: 0 28px 28px;
    align-items: center;
  }

  .diy-live .style-box-2 .goods-cover {
    width: 80px;
    height: 80px;
    border-radius: 16px;
    background: #999999;
  }

  .diy-live .style-box-2 .goods-item {
    display: flex;
    flex-direction: column;
    margin-left: 16px;
  }

  .diy-live .style-box-2 .goods-name {
    font-size: 26px;
    color: #666666;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    width: 194px;
  }

  .diy-live .style-box-2 .goods-price {
    font-size: 26px;
    color: #353535;
    margin-top: 16px;
  }

  /*样式三*/
  .diy-live .style-box-3 {
    display: flex;
    flex-direction: row;
    border-radius: 16px;
    overflow: hidden;
    background: #ffffff;
  }

  .diy-live .style-box-3 .live-item {
    position: relative;
  }

  .diy-live .style-box-3 .live-img {
    width: 360px;
    height: 360px;
    background: #999999;
    border-radius: 16px;
  }

  .diy-live .style-box-3 .label-box {
    position: absolute;
    top: 0;
    left: 0;
    border-top-right-radius: 24px;
    border-bottom-right-radius: 24px;
    display: flex;
    align-items: center;
  }

  .diy-live .style-box-3 .label-box-item {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    border-top-right-radius: 24px;
    border-bottom-right-radius: 24px;
    background: #22ac38;
  }

  .diy-live .style-box-3 .icon {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #ffffff;
  }

  .diy-live .style-box-3 .text {
    color: #ffffff;
    margin-left: 12px;
  }

  .diy-live .style-box-3 .text-time {
    color: #ffffff;
    margin-left: 12px;
  }

  .diy-live .style-box-3 .item {
    display: flex;
    flex-direction: column;
    padding: 0 20px;
  }

  .diy-live .style-box-3 .title {
    width: 310px;
    height: 100px;
    font-size: 36px;
    color: #353535;
    overflow: hidden;
    text-overflow: ellipsis;
    -webkit-line-clamp: 2;
    line-clamp: 2;
  }

  .diy-live .style-box-3 .user-info-box {
    display: flex;
    margin: 20px 0;
    align-items: center;
  }

  .diy-live .style-box-3 .avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #f7f7f7;
  }

  .diy-live .style-box-3 .nickname {
    color: #000;
    : #f7f7f7;
    margin-left: 12px;
    width: 258px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .diy-live .style-box-3 .goods-box {
    display: flex;
    justify-content: space-between;
  }

  .diy-live .style-box-3 .goods-box {
    display: flex;
    justify-content: space-between;
  }

  .diy-live .style-box-3 .goods-cover {
    width: 148px;
    height: 148px;
    border-radius: 16px;
    background: #999999;
    padding: 10px;
    display: flex;
    align-items: flex-end;
  }

  .diy-live .style-box-3 .goods-price {
    font-size: 24px;
    color: #ffffff;
  }

  .diy-live .style-box-3 .goods-cover-2 {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #ffffff;
  }

</style>
<template>
  <div :class="{'active':emptyData.isCked}">
    <div class="diy-component-options" v-if="emptyData.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-live">
      <div class="diy-component-preview" v-loading="!data">
        <div style="padding: 20px 0">
          <div class="diy-empty" :style="cStyle"></div>
        </div>
      </div>
      <div class="diy-component-edit" v-if="emptyData.isCked">
        <el-form label-width="100px" @submit.native.prevent>
          <el-form-item label="背景颜色">
            <el-color-picker size="small" v-model="data.background"></el-color-picker>
            <el-input size="small" style="width: 80px;margin-right: 25px;" v-model="data.background"></el-input>
          </el-form-item>
          <el-form-item label="高度">
            <el-input size="small" v-model.number="data.height" type="number" min="1">
              <div slot="append">px</div>
            </el-input>
          </el-form-item>
        </el-form>
      </div>
    </div>
  </div>
</template>
<script>
  export default {
    props: ["emptyData", "index", "dataLeng"],
    components: {},
    data() {
      return {
        loading: false,
        data: this.emptyData.data,

      };
    },
    created() {

    },
    methods: {
      //向父组件传值 并调用排序
      resetSord(IsUp) {
        this.$emit('getSord', this.index, IsUp);
      },
      //点击触发父组件删除
      delPlugin() {
        this.$emit('comDelPlugin', this.index);
      },
      showGoodsChange(e) {
        console.log(e)
      }
    },
    computed: {
      cStyle() {
        if (this.data.background) {
          return `background: ${this.data.background};` +
            `height: ${this.data.height}px;`;
        } else {
          return `height: ${this.data.height}px;`;
        }
      },
    },
    mounted() {

    }
  };

</script>
