From 1d472eb06970c85b0edfb58871956bc2c8d69916 Mon Sep 17 00:00:00 2001
From: zhengyiming <540361168@qq.com>
Date: 星期四, 25 十二月 2025 17:44:46 +0800
Subject: [PATCH] fix: 甲方小程序

---
 packages/components/src/Category/Category.vue |   59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 59 insertions(+), 0 deletions(-)

diff --git a/packages/components/src/Category/Category.vue b/packages/components/src/Category/Category.vue
new file mode 100644
index 0000000..c08e8eb
--- /dev/null
+++ b/packages/components/src/Category/Category.vue
@@ -0,0 +1,59 @@
+<template>
+  <div class="nut-category">
+    <div class="nut-category__cateList">
+      <div v-if="type == 'classify' || type == 'text'">
+        <div v-for="(item, index) in category" :key="index" class="nut-category__cateListLeft">
+          <div
+            :class="[
+              checkIndex == index
+                ? 'nut-category__cateListItemChecked'
+                : 'nut-category__cateListItem',
+            ]"
+            @click="getChildList(index)"
+          >
+            {{ item.catName }}
+          </div>
+        </div>
+      </div>
+
+      <slot></slot>
+    </div>
+  </div>
+</template>
+
+<script setup lang="ts">
+import { ref } from 'vue';
+
+defineOptions({
+  name: 'ProCategory',
+});
+
+type CategoryType = {
+  catName?: string;
+  [key: string]: any;
+};
+
+type Props = {
+  type?: 'classify' | 'text' | 'custom';
+  category?: CategoryType[];
+};
+
+const props = withDefaults(defineProps<Props>(), {
+  type: 'classify',
+  category: () => [],
+});
+
+const emit = defineEmits<{
+  (e: 'change', index: number): void;
+}>();
+
+const checkIndex = ref(0);
+const categoryLeft = ref(false); //鏄惁鏄剧ずslot
+
+const getChildList = (index: number) => {
+  checkIndex.value = index;
+  emit('change', index);
+};
+
+defineExpose({ getChildList });
+</script>

--
Gitblit v1.10.0