Skip to content

feat(Slider): Add slot to pass through tooltip content #4365

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: v3
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/runtime/components/Slider.vue
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@
(e: 'update:modelValue', payload: T): void
(e: 'change', payload: Event): void
}

export interface SliderSlots {
default(props?: {text: string | number}): any

Check failure on line 47 in src/runtime/components/Slider.vue

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest, 22)

A space is required before '}'

Check failure on line 47 in src/runtime/components/Slider.vue

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest, 22)

Requires a space before '}'

Check failure on line 47 in src/runtime/components/Slider.vue

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest, 22)

A space is required after '{'

Check failure on line 47 in src/runtime/components/Slider.vue

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest, 22)

Requires a space after '{'
}
</script>

<script setup lang="ts" generic="T extends number | number[]">
Expand Down Expand Up @@ -129,6 +133,9 @@
v-bind="(typeof tooltip === 'object' ? tooltip : {})"
>
<SliderThumb :class="ui.thumb({ class: props.ui?.thumb })" />
<template name="content" v-if="$slots.tooltip">

Check warning on line 136 in src/runtime/components/Slider.vue

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest, 22)

Attribute "v-if" should go before "name"

Check failure on line 136 in src/runtime/components/Slider.vue

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest, 22)

Unexpected useless attribute on `<template>`
<slot :text="thumbs > 1 ? String(sliderValue?.[thumb - 1]) : String(sliderValue)" />
</template>
</UTooltip>
<SliderThumb v-else :class="ui.thumb({ class: props.ui?.thumb })" />
</template>
Expand Down
Loading