docs(Slider): update demo

This commit is contained in:
chenjiahan
2020-09-17 11:37:30 +08:00
parent f0e5a1a428
commit adccdbcb21
4 changed files with 35 additions and 46 deletions
+12 -15
View File
@@ -109,18 +109,15 @@ export default {
### Vertical
```html
<div :style="{ height: '100px' }">
<van-slider v-model="value" vertical />
</div>
```
### Vertical, Dual thumb mode
Add `range` and `vertical` attributes at the same time, and make sure that the value of `value` is an array
```html
<div :style="{ height: '120px' }">
<van-slider v-model="value" range vertical @change="onChange" />
<div :style="{ height: '150px' }">
<van-slider v-model="value" vertical @change="onChange" />
<van-slider
v-model="value2"
range
vertical
style="margin-left: 100px;"
@change="onChange"
/>
</div>
```
@@ -130,8 +127,8 @@ import { Toast } from 'vant';
export default {
data() {
return {
// value must be an array
value: [10, 50],
value: 50,
value2: [10, 50],
};
},
methods: {
@@ -151,12 +148,12 @@ export default {
| value | Current value | _number \| array_ | `0` |
| max | Max value | _number \| string_ | `100` |
| min | Min value | _number \| string_ | `0` |
| range | Dual thumb mode | _boolean_ | `false` |
| step | Step size | _number \| string_ | `1` |
| bar-height | Height of bar | _number \| string_ | `2px` |
| button-size `v2.4.5` | Button size | _number \| string_ | `24px` |
| active-color | Active color of bar | _string_ | `#1989fa` |
| inactive-color | Inactive color of bar | _string_ | `#e5e5e5` |
| range `v2.10.7` | Whether to enable dual thumb mode | _boolean_ | `false` |
| disabled | Whether to disable slider | _boolean_ | `false` |
| vertical | Whether to display slider vertically | _boolean_ | `false` |