ant-design-vue/components/slider/demo/tip-formatter.vue

42 lines
742 B
Vue
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<docs>
---
order: 3
title:
zh-CN: 自定义提示
en-US: Customize tooltip
---
## zh-CN
使用 `tipFormatter` 可以格式化 `Tooltip` 的内容设置 `tipFormatter={null}`则隐藏 `Tooltip`
## en-US
Use `tipFormatter` to format content of `Tooltip`. If `tipFormatter` is null, hide it.
</docs>
<template>
<div>
<a-slider :tip-formatter="formatter" />
<a-slider :tip-formatter="null" />
</div>
</template>
<script lang="ts">
import { defineComponent, ref } from 'vue';
export default defineComponent({
setup() {
const disabled = ref<boolean>(false);
const formatter = (value: number) => {
return `${value}%`;
};
return {
disabled,
formatter,
};
},
});
</script>
```