<template>
  <div class="demo roll-list-circulation" style="height: 90%">
    <div class="list-item-header item-warp" :style="{ flex: listKeys.length }">
      <template v-for="(h, indexh) in listKeys" :key="indexh">
        <div class="item-td" :style="{ width: 'calc(100% / ' + listKeys.length + ')' }">{{ listKeysHeader[h] }}</div>
      </template>
    </div>
    <vue3ScrollSeamless class="scroll-wrap" :class-options="classOptions" :data-list="list">
      <div v-for="(item, index) in list" :key="index" class="list-item">
        <div class="list-item-content">
          <div class="list-item-boday item-warp" :style="{ flex: listKeys.length }">
            <template v-for="(b, indexb) in listKeys" :key="indexb">
              <div class="item-td" :class="{ 'td-title': b == 'title' }" :style="{ width: 'calc(100% / ' + listKeys.length + ')' }">
                {{ item[b] }}
              </div>
            </template>
          </div>
        </div>
      </div>
    </vue3ScrollSeamless>
  </div>
  <!-- </div> -->
</template>

<script setup>
import { ref, onMounted, onUnmounted, computed, reactive } from 'vue';
import { vue3ScrollSeamless } from 'vue3-scroll-seamless';
const props = defineProps({
  //   items: {
  //     type: Array,
  //     default: () => [],
  //   },
});

let list = reactive([
  { title: '耿马镇', demandArea: 103.1, dealArea: '84.2', maxPrice: '182.45', minPrice: '1489.5' },
  { title: '勐撒镇', demandArea: 159.2, dealArea: '58.6', maxPrice: '1569', minPrice: '1387' },
  { title: '孟定镇', demandArea: 188.3, dealArea: '102.6', maxPrice: '1468', minPrice: '1248' },
  { title: '孟简镇', demandArea: 98.7, dealArea: '23.5', maxPrice: '1839', minPrice: '1536' },
  { title: '孟永镇', demandArea: 165.5, dealArea: '123.5', maxPrice: '1883', minPrice: '1687' },
]);

const listKeys = reactive(['title', 'demandArea', 'dealArea', 'maxPrice', 'minPrice']);
const listKeysHeader = reactive({
  title: '乡/镇',
  demandArea: '需求面积',
  dealArea: '成交面积',
  maxPrice: '最高价',
  minPrice: '最高价',
});

const classOptions = {
  singleHeight: 48,
};
</script>

<style scoped lang="scss">
.roll-list-circulation {
  margin-top: 8px;
  .scroll-wrap {
    height: 80%;
    width: 100%;
    margin: 4px auto;
    overflow: hidden;
  }
  .list-item-header {
    background: #144482;
    font-size: 10px;
    width: 100%;
    .item-td {
      padding: 8px 6px;
    }
  }
  .list-item-boday {
    background: transparent;
    width: 100%;
    .item-td {
      padding: 4px 6px;
      &.td-title {
        color: #6beff9 !important;
      }
    }
  }
  .item-warp {
    display: inline-flex;
    justify-content: space-around;
    .item-td {
      display: inline-block;
      vertical-align: middle;

      text-align: center;
      color: #fff;
    }
  }
  .list-item {
    // border-bottom: 1px dashed rgba(255, 255, 255, 0.2);
    line-height: 18px;

    .list-item-content {
      display: inline-flex;
      width: 100%;
      justify-content: space-around;
      position: relative;
    }
  }
}
.demo {
  //   display: flex;
  //   align-items: center;
  //   justify-content: center;
  //   margin-top: 10px;
}
</style>
