fuchengshen
2022-07-09 3a25c05b5ab837714f30469cdcb1e2a77d8d7f6c
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
<template>
  <a-select class="mars-select" dropdownClassName="mars-select-dropdown" v-bind="attrs">
    <template v-for="(comp, name) in slots" :key="name" v-slot:[name]>
      <component :is="comp" />
    </template>
  </a-select>
</template>
<script lang="ts">
import { useAttrs, useSlots, defineComponent } from "vue"
export default defineComponent({
  name: "mars-select",
  inheritAttrs: false,
  setup() {
    const attrs = useAttrs()
    const slots = useSlots()
    return {
      attrs,
      slots
    }
  }
})
</script>
<style lang="less" scoped>
.mars-select {
  color: @mars-base-color;
  background-color: transparent !important;
  background: none;
  :deep(.ant-select-selector) {
    border-color: @mars-base-border-color !important;
    background: none;
    background-color: transparent !important;
    &:hover,
    &:focus {
      border-color: #4db3ff !important;
    }
  }
 
  :deep(.ant-select-arrow) {
    color: @mars-base-color !important;
  }
}
</style>
<style lang="less">
// 下拉选择
.mars-select-dropdown {
  padding: 0 !important;
  .mars-drop-bg();
  .ant-select-item-option-active:not(.ant-select-item-option-disabled) {
    background: @mars-list-active;
  }
  .ant-select-item-option-selected:not(.ant-select-item-option-disabled) {
    font-weight: 700;
    background: @mars-list-active;
  }
  .ant-select-item {
    transition: none;
    color: @mars-base-color !important;
    text-align: center;
  }
}
</style>