vant/packages/slider/en-US.md
2018-10-18 18:50:23 +08:00

67 lines
1.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

## Slider
### Install
``` javascript
import { Slider } from 'vant';
Vue.use(Slider);
```
### Usage
#### Basic Usage
```html
<van-slider v-model="value" @change="onChange" />
```
```js
export default {
data() {
return {
value: 50
};
},
methods: {
onChange(value) {
this.$toast('Current value' + value);
}
}
};
```
#### Range
```html
<van-slider v-model="value" :min="10" :max="90" />
```
#### Disabled
```html
<van-slider v-model="value" disabled />
```
#### Step size
```html
<van-slider v-model="value" :step="10" bar-height="4px" />
```
### API
| Attribute | Description | Type | Default |
|------|------|------|------|------|
| value | Current value | `Number` | `0` |
| disabled | Whether to disable slider | `Boolean` | `false` |
| max | Max value | `Number` | `100` |
| min | Min value | `Number` | `0` |
| step | Step size | `Number` | `1` |
| bar-height | Height of bar | `String` | `2px` |
### Event
| Event | Description | Arguments |
|------|------|------|
| change | Triggered after value change | value: current rate |