Skip to content

Commit 89ba6e5

Browse files
committed
fix: 修改slider组件文档
1 parent 01a817d commit 89ba6e5

File tree

1 file changed

+63
-64
lines changed

1 file changed

+63
-64
lines changed

docs/components/slider/index.md

Lines changed: 63 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,82 @@
11
# Slider 滑动输入条
22

3-
滑动输入条
3+
滑动输入条
44

55
### 何时使用
66

7-
当用户需要在数值区间内进行选择时使用
7+
当用户需要在数值区间内进行选择时使用
88

99
### 基本用法
1010

11-
<br />
11+
:::demo
12+
13+
```vue
1214
<d-slider :min="minValue" :max="maxValue" v-model='inputValue'></d-slider>
13-
<br />
15+
<script>
16+
import { defineComponent, ref } from 'vue'
1417
15-
### 带有输入框的滑动组件
18+
export default defineComponent({
19+
setup() {
20+
const inputValue = ref(0);
21+
const minValue = ref(0);
22+
const maxValue = ref(100);
1623
17-
<br />
18-
<d-slider :min="minValue" :max="maxValue" v-model='inputValue2' showInput></d-slider>
19-
<br />
24+
return {
25+
inputValue,
26+
maxValue,
27+
minValue
28+
};
29+
},
30+
});
31+
</script>
32+
```
2033

21-
### 可设置 Step 的滑动组件
22-
<br />
23-
<d-slider :min="minValue" :max="maxValue" v-model='inputValue3' :step="step"></d-slider>
34+
:::
2435

25-
<br />
36+
### 带有输入框的滑动组件
2637

27-
```html
28-
<template>
38+
:::demo
2939

30-
<d-slider :min="minValue" :max="maxValue" v-model="inputValue"></d-slider>
40+
```vue
41+
<d-slider :min="minValue" :max="maxValue" v-model='inputValue' showInput></d-slider>
42+
<script>
43+
import { defineComponent, ref } from 'vue'
3144
32-
<d-slider :min="minValue" :max="maxValue" v-model="inputValue2" showInput></d-slider>
45+
export default defineComponent({
46+
setup() {
47+
const inputValue = ref(0);
48+
const minValue = ref(0);
49+
const maxValue = ref(100);
3350
34-
<d-slider :min="minValue" :max="maxValue" v-model="inputValue3" :step="step"></d-slider>
51+
return {
52+
inputValue,
53+
maxValue,
54+
minValue
55+
};
56+
},
57+
});
58+
</script>
59+
```
60+
61+
:::
3562

36-
</template>
37-
<script lang="ts">
38-
import { defineComponent, ref } from "vue";
63+
### 可设置 Step 的滑动组件
64+
:::demo
65+
66+
```vue
67+
<d-slider :min="minValue" :max="maxValue" v-model="inputValue" showInput :step="step"></d-slider>
68+
<script>
69+
import { defineComponent, ref } from 'vue'
3970
4071
export default defineComponent({
4172
setup() {
42-
43-
const inputValue = ref(12);
44-
const inputValue2 = ref(15);
45-
const inputValue3 = ref(5);
46-
const minValue = ref(2);
47-
const maxValue = ref(50);
73+
const inputValue = ref(0);
74+
const minValue = ref(0);
75+
const maxValue = ref(100);
4876
const step = ref(4);
4977
5078
return {
5179
inputValue,
52-
inputValue2,
53-
inputValue3
5480
maxValue,
5581
minValue,
5682
step
@@ -59,19 +85,16 @@
5985
});
6086
</script>
6187
```
88+
:::
6289

6390
### 禁止输入态
6491

65-
<br />
66-
<d-slider :min="minValue" :max="maxValue" :disabled="true" v-model='disabledValue'></d-slider>
67-
<br />
92+
:::demo
6893

69-
```html
70-
<template>
94+
```vue
7195
<d-slider :min="minValue" :max="maxValue" :disabled="true" v-model='disabledValue'></d-slider>
72-
</template>
73-
<script lang="ts">
74-
import { defineComponent, ref } from "vue";
96+
<script>
97+
import { defineComponent, ref } from 'vue'
7598
7699
export default defineComponent({
77100
setup() {
@@ -88,31 +111,7 @@
88111
});
89112
</script>
90113
```
91-
92-
<script lang="ts">
93-
import { defineComponent, ref } from 'vue'
94-
export default defineComponent({
95-
setup() {
96-
const disabledValue = ref(5);
97-
const inputValue = ref(12);
98-
const inputValue2 = ref(15);
99-
const inputValue3 = ref(5);
100-
const minValue = ref(2);
101-
const maxValue = ref(50);
102-
const step = ref(4);
103-
104-
return {
105-
disabledValue,
106-
inputValue,
107-
inputValue2,
108-
inputValue3,
109-
maxValue,
110-
minValue,
111-
step
112-
}
113-
}
114-
})
115-
</script>
114+
:::
116115

117116
### API
118117

@@ -122,6 +121,6 @@ d-slider 参数
122121
| --------- | ------- | ----- | ------------------------------------------------------------------- | ---- |
123122
| max | number | 100 | 可选,滑动输入条的最大值 |[基本用法](#基本用法) |
124123
| min | number | 0 | 可选,滑动输入条的最小值 |[基本用法](#基本用法) |
125-
| step | number | 1 | 可选,滑动输入条的步长,取值必须大于等于1,且必须可被(max-min)整除 |[基本用法](#可设置Step的滑动组件) |
126-
| disabled | boolean | false | 可选,值为 true 时禁止用户输入 |[基本用法](#禁止输入态) |
127-
| showInput | boolean | false | 可选,值为 true 显示输入框 |[基本用法](#带有输入框的滑动组件) |
124+
| showInput | boolean | false | 可选,值为 true 显示输入框 |[带有输入框的滑动组件](#带有输入框的滑动组件) |
125+
| step | number | 1 | 可选,滑动输入条的步长,取值必须大于等于1,且必须可被(max-min)整除 |[可设置 Step 的滑动组件](#可设置Step的滑动组件) |
126+
| disabled | boolean | false | 可选,值为 true 时禁止用户输入 |[禁止输入态](#禁止输入态) |

0 commit comments

Comments
 (0)