ZhangXianQiang
2024-06-05 dd17279c40da15f32f6f5e00005cdc0f08107a21
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<template>
  <div class="sheet-container w-full h-full">
    <el-scrollbar>
      <el-collapse v-model="activeNames" @change="handleChange">
        <template v-for="item in sheetList">
          <el-collapse-item :title="item.title" :name="item.type">
            <div class="sheet-list grid grid-cols-5 gap-4 justify-items-center">
              <div class="sheet-item cursor-pointer flex justify-center items-center" v-for="index in item.total" @click="sheetClick(item,index)" :class="itemClass(item.type, index)">
                {{ index }}
              </div>
            </div>
          </el-collapse-item>
        </template>
      </el-collapse>
    </el-scrollbar>
  </div>
</template>
 
<script setup>
import { ref } from 'vue';
 
const categroy = ref(0);
const sheetIndex = ref(0);
 
const itemClass = (type,index) => {
  return {
    active: categroy.value === type && sheetIndex.value === index
  }
}
 
 
const sheetList = ref([
  {
    title: '单选题',
    type: 1,
    total: 20,
  },
  {
    title: '多选题',
    type: 2,
    total: 20,
  },
  {
    title: '判断题',
    type: 3,
    total: 20,
  },
]);
 
const activeNames = ref(sheetList.value.map(item => item.type));
 
 
const handleChange = () => {
 
};
 
const sheetClick = (item, index) => {
  categroy.value = item.type;
  sheetIndex.value = index;
}
</script>
 
<style lang="scss" scoped>
.sheet-list {
  width: 97%;
}
.sheet-item {
  width: 35px;
  height: 35px;
  border: 1px solid #DCDFE6;
  background-color: #fff;
  color: #374151;
}
 
.active {
  border-color: #3680fa;
}
</style>