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
62
63
64
65
66
67
68
69
70
71
72
<template>
  <a-date-picker :locale="locale" :dayjs="dayjs" class="mars-date-picker" dropdownClassName="mars-datepicker-dropdown" v-bind="attrs">
    <template v-for="(comp, name) in slots" :key="name" v-slot:[name]>
      <component :is="comp" />
    </template>
  </a-date-picker>
</template>
<script lang="ts">
import { useAttrs, useSlots, defineComponent } from "vue"
import dayjs from "dayjs"
import "dayjs/locale/zh-cn"
import locale from "ant-design-vue/es/date-picker/locale/zh_CN"
export default defineComponent({
  name: "mars-date-picker",
  inheritAttrs: false,
  setup() {
    const attrs = useAttrs()
    const slots = useSlots()
    return {
      attrs,
      slots,
      dayjs,
      locale
    }
  }
})
</script>
<style lang="less" scoped>
.mars-date-picker {
  color: @mars-base-color;
  border-color: @mars-base-border-color !important;
  background-color: transparent !important;
  &:hover {
    border-color: @mars-primary-color !important;
  }
 
  :deep(.ant-picker-input) {
    input {
      color: @mars-base-color !important;
    }
  }
  :deep(.ant-picker-clear) {
    background: @mars-bg-base;
    color: @mars-base-color !important;
  }
  :deep(.ant-picker-suffix *) {
    color: @mars-base-color;
  }
}
</style>
<style lang="less">
.mars-datepicker-dropdown {
  .ant-picker-panel-container {
    .mars-drop-bg();
  }
  *,
  .ant-picker-content th {
    color: @mars-base-color;
  }
  .ant-picker-footer {
    border: none;
  }
  .ant-picker-cell {
    &:hover,
    &.ant-picker-cell-selected {
      .ant-picker-cell-inner {
        background-color: @mars-primary-color !important;
      }
    }
  }
}
</style>