mirror of
https://gitee.com/element-plus/element-plus.git
synced 2024-12-14 17:31:02 +08:00
50 lines
1.2 KiB
Vue
50 lines
1.2 KiB
Vue
|
<template>
|
||
|
<div class="slider-demo-block">
|
||
|
<span class="demonstration">Default value</span>
|
||
|
<el-slider v-model="value1"></el-slider>
|
||
|
</div>
|
||
|
<div class="slider-demo-block">
|
||
|
<span class="demonstration">Customized initial value</span>
|
||
|
<el-slider v-model="value2"></el-slider>
|
||
|
</div>
|
||
|
<div class="slider-demo-block">
|
||
|
<span class="demonstration">Hide Tooltip</span>
|
||
|
<el-slider v-model="value3" :show-tooltip="false"></el-slider>
|
||
|
</div>
|
||
|
<div class="slider-demo-block">
|
||
|
<span class="demonstration">Format Tooltip</span>
|
||
|
<el-slider v-model="value4" :format-tooltip="formatTooltip"></el-slider>
|
||
|
</div>
|
||
|
<div class="slider-demo-block">
|
||
|
<span class="demonstration">Disabled</span>
|
||
|
<el-slider v-model="value5" disabled></el-slider>
|
||
|
</div>
|
||
|
</template>
|
||
|
|
||
|
<script lang="ts">
|
||
|
import { ref, defineComponent } from 'vue'
|
||
|
|
||
|
export default defineComponent({
|
||
|
setup() {
|
||
|
const value1 = ref(0)
|
||
|
const value2 = ref(0)
|
||
|
const value3 = ref(0)
|
||
|
const value4 = ref(0)
|
||
|
const value5 = ref(0)
|
||
|
|
||
|
const formatTooltip = (val) => {
|
||
|
return val / 100
|
||
|
}
|
||
|
|
||
|
return {
|
||
|
value1,
|
||
|
value2,
|
||
|
value3,
|
||
|
value4,
|
||
|
value5,
|
||
|
formatTooltip,
|
||
|
}
|
||
|
},
|
||
|
})
|
||
|
</script>
|