ny
22 小时以前 282fbc6488f4e8ceb5fda759f963ee88fbf7b999
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<script lang="ts" setup>
import { computed, unref } from 'vue';
 
import { useAttrs } from '@jnpf/hooks';
 
import { Slider } from 'ant-design-vue';
 
defineOptions({ inheritAttrs: false, name: 'JnpfSlider' });
 
const attrs: any = useAttrs({ excludeDefaultKeys: false });
 
const getBindValue: any = computed(() => ({ ...unref(attrs) }));
const getStyle = computed(() => (Reflect.has(unref(attrs), 'style') ? unref(attrs).style : {}));
</script>
 
<template>
  <div :style="getStyle" class="jnpf-slider px-[5px]">
    <Slider v-bind="getBindValue">
      <template v-for="item in Object.keys($slots)" #[item]="data">
        <slot :name="item" v-bind="data || {}"></slot>
      </template>
    </Slider>
  </div>
</template>