<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">
      <div class="item" v-for="(i,k) in data.list">
        <i class="del el-icon-circle-close" @click="data.list.splice(k, 1);"></i>
        <div class="icon">
          <UploadEl :data="i"/>
        </div>
        <div class="itemTitle" contenteditable="true" @blur="edit1('title', k,$event)">{{ i.title }}</div>
        <div class="itemInfo" contenteditable="true" @blur="edit1('info', k,$event)">{{ i.value }}</div>
      </div>
      <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: 13.3vw"></i>
        </div>
      </div>
    </div>
  </div>
</template>

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

export default {
  name: 'PlatformFeatures',
  props: ['data'],
  components: {UploadEl},
  computed: {},

  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 {
  width: 65vw;
  display: inline-block;
  margin-top: 3.8vw;
  margin-bottom: 2.8vw;
  box-shadow: 0 0 3px #0002;


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

  .item {
    display: inline-block;
    position: relative;
    width: calc(100% / 3 - 2px);
    height: 13.3vw;
    border: 1px solid #3332;
    margin: 0;
    overflow: hidden;
    float: left;
    transition: all 0.2s;

    &:hover {
      background-color: @standard-color;

      .itemTitle {
        color: #fff;
      }

      .itemInfo {
        color: #eee;
      }
    }

    .icon {
      width: 2.3vw;
      height: 2.3vw;
      position: absolute;
      top: 22%;
      left: 50%;
      transform: translate(-50%, -50%);
    }

    .itemTitle {
      top: 42%;
      left: 50%;
      position: absolute;
      transform: translate(-50%, -50%);
      font-size: 1.1vw;
      letter-spacing: 1px;
      transition: all 0.2s;
    }

    .itemInfo {
      top: 52.2%;
      left: 9.6%;
      position: absolute;
      font-size: 0.8vw;
      line-height: 1.5vw;
      color: #666;
      letter-spacing: 2.5px;
      text-align: left;
      width: 80%;
      transition: all 0.2s;
    }
  }
}

</style>
