riku
2023-07-14 023dd7fafa5d1a39d6f62ba88b6c4ec590aa20cd
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
79
80
81
82
83
84
85
86
87
<template>
  <ul class="list-container">
    <el-scrollbar>
      <template v-for="(item, index) in dataList" :key="index">
        <li
          :class="
            'list-item ' +
            (item.selected ? 'list-item__selected' : '')
          "
          @click="selectItem(item)"
          @mouseover="item.show = true"
          @mouseleave="item.show = false"
          v-if="!item.delete"
        >
          <div style="display: flex; gap: 8px">
            <div>{{ item.id }}</div>
            <div>{{ item.clueName }}</div>
          </div>
        </li>
      </template>
    </el-scrollbar>
  </ul>
</template>
 
<script>
export default {
  props: {
    dataList: Array
  },
  emits: ['itemSelected'],
  data() {
    return {};
  },
  watch: {},
  methods: {
    // 列表选择
    selectItem(item) {
      this.$emit('itemSelected', item);
    },
    clearSelect() {}
  }
};
</script>
<style scoped>
.list-container {
  /* background-color: antiquewhite; */
  padding: initial;
  height: 50vh;
  overflow: auto;
  overflow-x: hidden;
  border: var(--el-border);
}
 
.list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px;
  list-style-type: none;
  /* background-color: aqua; */
  /* border: var(--el-border); */
  border-radius: var(--el-border-radius-base);
  box-shadow: var(--el-box-shadow-lighter);
  margin-bottom: 2px;
  cursor: pointer;
  line-height: 36px;
}
 
.list-item:hover {
  background-color: var(--el-color-primary-light-9);
}
 
.list-item__selected {
  background-color: var(--el-color-primary-light-9);
}
 
.v-enter-from,
.v-leave-to {
  opacity: 0;
  transform: translateX(8px);
}
 
.v-enter-active,
.v-leave-active {
  transition: all 0.3s ease-out;
}
</style>