<!--左侧工具栏 -- 图例列表-->
<template>
  <div class="lengend-list">
    <!-- 基础图例 -->
    <div class="lengend-item" v-for="(item,index) in baseEditItems" :key="index">
      <span class="legend-title">{{item.title}}</span>
      <div class="legend-content" v-for="(itemList,i) in item.itemList" :key="i">
        <div class="title">{{itemList.title}}</div>
        <ul>
          <li
            :class="{ 'btn-active': choiceLegend== baseItem.id }"
            v-for="(baseItem,k) in itemList.itemList"
            :key="k"
            @click="drawItem(baseItem.id)"
          >
            <div class="icon"></div>
            <span>{{baseItem.name}}</span>
          </li>
        </ul>
      </div>
    </div>
  </div>
</template>
<script>
import { baseEditItems } from "./data";
import { mapMutations, mapState } from "vuex";
export default {
  data() {
    return {
      baseEditItems
      // choiceLegend: "" //选中绘制类型
    };
  },
  computed: {
    ...mapState(["choiceLegend"])
  },
  methods: {
    ...mapMutations(["SETCHOICELEHEND"]),
    drawItem(item) {
      this.SETCHOICELEHEND(item);
    }
  }
};
</script>
<style scoped lang="less">
.lengend-list {
  width: 100%;
  .lengend-item {
    width: 100%;
    .legend-title {
      display: block;
      font-size: 14px;
      height: 14px;
      line-height: 14px;
      margin-left: 10px;
      color: #8D9399;
    }
    .legend-content {
      padding: 0 10 10px 10px;
      box-sizing: border-box;
      .title {
        margin-left: 10px;
        font-weight: bold;
        border-top: 1px solid #eee;
        padding-top: 10px;
        padding-bottom: 10px;
      }
      ul {
        display: flex;
        justify-content: space-around;
        li {
          font-size: 12px;
          width: 44px;
          height: 44px;
          display: flex;
          align-items: center;
          justify-content: center;
          flex-direction: column;
          padding: 4px;
          box-sizing: border-box;
          .icon {
            width: 22px;
            height: 22px;
            background: red;
          }
          cursor: pointer;
        }
        li:hover {
          background: #e1f2ff;
        }
        .btn-active {
          background: #e1f2ff;
        }
      }
    }
  }
}
</style>