<template>
  <div class="cate-container">
    <div class="cate-wrap">
      <div class="wrap-container">
        <div class="cate-title">类型</div>
        <template v-for="(item, key) in types">
          <div class="cate-item" :class="select_types == item.value ? 'cate-item-active' : ''" @click="handleClaSelect(item)">{{ item.name }}</div>
        </template>
      </div>
    </div>
  </div>
</template>
<script setup>
import _ from 'lodash';

import { getZHTypes } from '@/utils/index';
const props = defineProps({});

const types = ref(getZHTypes());
const emits = defineEmits(['claSelect']);

const select_types = ref('template');
//点击分类
function handleClaSelect(item) {
  select_types.value = item.value;
  emits('claSelect', item.value);
}
</script>
<style scoped lang="scss">
.cate-container {
  margin-top: 10px;

  .cate-wrap {
    max-height: 40px;
    overflow: hidden;

    .wrap-container {
      background-color: #ffffff;
      display: flex;
      flex-wrap: wrap;
      z-index: 2;
      border: solid 1px #fff;
      border-radius: 4px;
      padding: 0 16px;
    }
  }
  .cate-wrap,
  .cate-line {
    padding: 5px 0;
    display: flex;
    flex-wrap: wrap;
  }
  .cate-line {
    margin-top: 10px;
  }
  .cate-title {
    display: flex;
    min-width: 35px;
    padding: 0;
    margin-right: 16px;
    color: #b4b8bf;
    cursor: default;
    align-items: center;
    width: -webkit-max-content;
    width: -moz-max-content;
    width: max-content;
    height: 32px;
  }
  .cate-item {
    flex-shrink: 0;
    margin: 0 12px 5px 0;
    min-width: 52px;
    text-align: center;
    border-radius: 4px;
    border: 1px solid transparent;
    position: relative;
    height: 32px;
    padding: 0 15px;
    color: rgba(0, 0, 0, 0.85);
    font-size: 14px;
    line-height: 30px;
    cursor: pointer;
    transition:
      color 0.3s,
      background 0.3s,
      border-color 0.3s,
      box-shadow 0.3s;
  }
  .cate-item-active {
    font-weight: 500;
    border: 1px solid #3a2be0;
    color: #3a2be0;
    background-color: #f4f3ff;
  }
}
</style>
