<script lang="ts" setup name="benchCol">
// 逻辑代码
const props = defineProps({
  title: {
    type: String,
    default: '',
  },
  icon: {
    type: String,
    default: '',
  },
  pathUrl: {
    type: String,
    default: '',
  },
  width: {
    type: String,
    default: '100%',
  },
  height: {
    type: [String, Number],
    default: '',
  },
})
</script>

<template>
  <div class="bench-left-top" :style="{ height: typeof height == 'string' ? height : `${height}px` }">
    <div v-if="title" class="bench-title">
      <el-icon v-if="icon" :name="icon" class="title-icon">
        <svg-icon :name="icon" />
      </el-icon>
      <div class="title">
        {{ title }}
      </div>
      <span v-if="pathUrl !== ''" class="more" @click="$router.push(pathUrl)">更多 ></span>
    </div>
    <div class="content" :style="{ height: typeof height == 'string' ? height : `${height - 50}px` }">
      <slot />
    </div>
  </div>
</template>

<style lang="scss" scoped>
// 样式
.bench-left-top {
  border-radius: 10px;
  background-color: #fff;
  padding: 10px;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  width: 100%;

  .bench-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 10px;
    height: 30px;
    overflow: hidden;

    .title-icon {
      width: 14px;
      height: 14px;
      font-size: 14px;
      line-height: 16px;
      color: #3d7eff;
      margin-right: 5px;
    }

    .title {
      color: #000;
      font-size: 16px;
      flex: 1;
    }

    .more {
      cursor: pointer;
      font-size: 14px;
      color: #ccc;
    }
  }

  .content {
    flex: 1;
    width: 100%;
    box-sizing: border-box;
  }

  .bench-title + .content {
    padding-top: 10px;
  }
}
</style>

