<template>
  <div>
    <div class="title">
      <span contenteditable="true" @blur="edit('title', $event)">
        {{ data.title }}
      </span>
    </div>
    <div class="subTitle">
      <span contenteditable="true" @blur="edit('subTitle', $event)">
        {{ data.subTitle }}
      </span>
    </div>
    <div class="list">
      <template v-for="(i,k) in data.list">
        <div class="item">
          <i class="del el-icon-circle-close" @click="data.list.splice(k, 1);"></i>
          <UploadEl :data="i"/>
        </div>
        <br class="br" v-if="(k+1)%3===0"/>
      </template>
      <div class="item">
        <div style="width:100%;height:100%;"
             @click="data.list.push({title:'请输入',value:'请输入'})">
          <i class="el-icon-circle-plus" style="font-size: 3vw; line-height: 16.7vw"></i>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import UploadEl from "@/components/editEl/uploadEl.vue";

export default {
  name: 'EditEl10',
  props: ['data'],
  components: {UploadEl},
  data() {
    return {}
  },
  mounted() {
  },
  methods: {
    edit(key, e) {
      this.$props.data[key] = e.target.innerText
    },
    edit1(key, index, e) {
      this.$props.data.list[index][key] = e.target.innerText
    },
  }
}
</script>

<style lang="less" scoped>
@import "~@/style.less";


.title {
  padding-top: 4.2vw;
  width: 100%;
  text-align: center;
  font-size: 2.5vw;
  letter-spacing: 4px;
  color: #0003;
}

.subTitle {
  padding-top: 0.4vw;
  width: 100%;
  text-align: center;
  font-size: 1.9vw;
  letter-spacing: 2px;
  color: #000;
}

.list {
  margin: 3.9vw auto 0;
  padding-bottom: 5.3vw;
  width: 60vw;
  //display: flex;
  //justify-content: space-between;
  //align-items: center;
  flex-wrap: wrap;

  .br {
    display: block;
    content: '';
    flex-basis: 100%;
    width: 0;
  }

  .item {
    display: inline-block;
    width: 30%;
    //height: 16.7vw;
    margin: 0 0.5vw;
    vertical-align: top;
    position: relative;

    .del {
      position: absolute;
      right: 10px;
      top: 10px;
      cursor: pointer;
    }

  }
}
</style>
