Skip to content

Commit

Permalink
feat(slider): label support % format (Tencent#2613)
Browse files Browse the repository at this point in the history
  • Loading branch information
uyarn authored and methodchen committed Aug 25, 2023
1 parent 7363d6a commit 67859bf
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/_common
Submodule _common updated 1 files
+1 −1 js/slider/utils.ts
2 changes: 2 additions & 0 deletions src/slider/slider-button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { TdSliderProps } from './type';
import { TdTooltipProps } from '../tooltip/type';
import { renderTNodeJSXDefault } from '../utils/render-tnode';
import { getClassPrefixMixins } from '../config-provider/config-receiver';
import { formatLabel } from '../_common/js/slider/utils';
import mixins from '../utils/mixins';

const classPrefixMixins = getClassPrefixMixins('slider__button');
Expand Down Expand Up @@ -123,6 +124,7 @@ export default mixins(classPrefixMixins, Vue as VueConstructor<SliderInstanceTyp
methods: {
getTooltipContent() {
if (typeof this.label === 'boolean') return String(this.value);
if (typeof this.label === 'string') return formatLabel(this.label, this.value as number);
return renderTNodeJSXDefault(this, 'label', {
params: this.range
? {
Expand Down

0 comments on commit 67859bf

Please sign in to comment.