mirror of
https://gitee.com/element-plus/element-plus.git
synced 2024-12-01 10:47:57 +08:00
docs(slider): add docs files
This commit is contained in:
parent
c659d45d86
commit
ab1a1546e0
56
packages/slider/doc/basic-usage.vue
Normal file
56
packages/slider/doc/basic-usage.vue
Normal file
@ -0,0 +1,56 @@
|
||||
<template>
|
||||
<div class="block">
|
||||
<span class="demonstration">默认</span>
|
||||
<el-slider v-model="value1" />
|
||||
</div>
|
||||
<div class="block">
|
||||
<span class="demonstration">自定义初始值</span>
|
||||
<el-slider v-model="value2" />
|
||||
</div>
|
||||
<div class="block">
|
||||
<span class="demonstration">隐藏 Tooltip</span>
|
||||
<el-slider v-model="value3" :show-tooltip="false" />
|
||||
</div>
|
||||
<div class="block">
|
||||
<span class="demonstration">格式化 Tooltip</span>
|
||||
<el-slider v-model="value4" :format-tooltip="formatTooltip" />
|
||||
</div>
|
||||
<div class="block">
|
||||
<span class="demonstration">禁用</span>
|
||||
<el-slider v-model="value5" disabled />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { reactive, toRefs } from 'vue'
|
||||
|
||||
export default {
|
||||
setup() {
|
||||
const values = reactive({
|
||||
value1: 30,
|
||||
value2: 50,
|
||||
value3: 36,
|
||||
value4: 48,
|
||||
value5: 42,
|
||||
})
|
||||
const formatTooltip = (val: number) => `当前: ${ val }`
|
||||
return {
|
||||
...toRefs(values),
|
||||
formatTooltip,
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
.block {
|
||||
padding: 30px 24px;
|
||||
overflow: hidden;
|
||||
border-bottom: 1px solid #EFF2F6;
|
||||
}
|
||||
|
||||
.demonstration {
|
||||
font-size: 14px;
|
||||
color: #8492A6;
|
||||
line-height: 44px;
|
||||
}
|
||||
</style>
|
40
packages/slider/doc/discrete-values.vue
Normal file
40
packages/slider/doc/discrete-values.vue
Normal file
@ -0,0 +1,40 @@
|
||||
<template>
|
||||
<div class="block">
|
||||
<span class="demonstration">Breakpoints not displayed</span>
|
||||
<el-slider
|
||||
v-model="value1"
|
||||
:step="10"
|
||||
/>
|
||||
</div>
|
||||
<div class="block">
|
||||
<span class="demonstration">Breakpoints displayed</span>
|
||||
<el-slider
|
||||
v-model="value2"
|
||||
:step="10"
|
||||
show-stops
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { reactive, toRefs } from 'vue'
|
||||
|
||||
export default {
|
||||
setup() {
|
||||
const values = reactive({
|
||||
value1: 0,
|
||||
value2: 0,
|
||||
})
|
||||
return {
|
||||
...toRefs(values),
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
.demonstration {
|
||||
font-size: 14px;
|
||||
color: #8492A6;
|
||||
line-height: 44px;
|
||||
}
|
||||
</style>
|
14
packages/slider/doc/index.stories.ts
Normal file
14
packages/slider/doc/index.stories.ts
Normal file
@ -0,0 +1,14 @@
|
||||
export default {
|
||||
title: 'Slider',
|
||||
}
|
||||
|
||||
export { default as BasicUsage } from './basic-usage.vue'
|
||||
|
||||
export { default as DiscreteValues } from './discrete-values.vue'
|
||||
|
||||
export { default as RangeSelection } from './range-selection.vue'
|
||||
|
||||
export { default as VerticalMode } from './vertical-mode.vue'
|
||||
|
||||
export { default as ShowMarks } from './show-marks.vue'
|
||||
|
23
packages/slider/doc/range-selection.vue
Normal file
23
packages/slider/doc/range-selection.vue
Normal file
@ -0,0 +1,23 @@
|
||||
<template>
|
||||
<div class="block">
|
||||
<el-slider
|
||||
v-model="value"
|
||||
range
|
||||
show-stops
|
||||
:max="10"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { ref } from 'vue'
|
||||
|
||||
export default {
|
||||
setup() {
|
||||
const value = ref([2, 5])
|
||||
return {
|
||||
value,
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
34
packages/slider/doc/show-marks.vue
Normal file
34
packages/slider/doc/show-marks.vue
Normal file
@ -0,0 +1,34 @@
|
||||
<template>
|
||||
<div class="block">
|
||||
<el-slider
|
||||
v-model="value"
|
||||
range
|
||||
:marks="marks"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { h, ref } from 'vue'
|
||||
|
||||
export default {
|
||||
setup() {
|
||||
const value = ref([30, 60])
|
||||
const marks = {
|
||||
0: '0°C',
|
||||
8: '8°C',
|
||||
37: '37°C',
|
||||
50: {
|
||||
style: {
|
||||
color: '#1989FA',
|
||||
},
|
||||
label: h('strong', '50%'),
|
||||
},
|
||||
}
|
||||
return {
|
||||
value,
|
||||
marks,
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
22
packages/slider/doc/vertical-mode.vue
Normal file
22
packages/slider/doc/vertical-mode.vue
Normal file
@ -0,0 +1,22 @@
|
||||
<template>
|
||||
<div class="block">
|
||||
<el-slider
|
||||
v-model="value"
|
||||
vertical
|
||||
height="200px"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { ref } from 'vue'
|
||||
|
||||
export default {
|
||||
setup() {
|
||||
const value = ref(0)
|
||||
return {
|
||||
value,
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
Loading…
Reference in New Issue
Block a user