Stepper 步进器
增加,减少或修改当前数值
引入
import { Stepper } from 'mand-mobile'
Vue.component(Stepper.name, Stepper)
代码演示
禁用
<template>
<div class="md-example-child md-example-child-stepper md-example-child-stepper-0">
<md-field>
<md-field-item
name="arrow1"
title="禁用"
customized
align="right">
<div class="normal-tip">
<md-stepper
disabled
></md-stepper>
</div>
</md-field-item>
</md-field>
</div>
</template>
<script>
import {Stepper, Field, FieldItem} from 'mand-mobile'
export default {
name: 'stepper-demo',
components: {
[Field.name]: Field,
[FieldItem.name]: FieldItem,
[Stepper.name]: Stepper,
},
}
</script>
最小值-12,最大值18
<template>
<div class="md-example-child md-example-child-stepper md-example-child-stepper-2">
<md-field>
<md-field-item
name="arrow3"
title="最小值-12,最大值18"
customized
align="right">
<div class="normal-tip">
<md-stepper
v-model="value"
min="-12"
max="18"
></md-stepper>
</div>
</md-field-item>
</md-field>
</div>
</template>
<script>
import {Stepper, Field, FieldItem} from 'mand-mobile'
export default {
name: 'stepper-demo',
components: {
[Field.name]: Field,
[FieldItem.name]: FieldItem,
[Stepper.name]: Stepper,
},
data() {
return {
value: 0,
}
},
}
</script>
最小值4大于默认值
<template>
<div class="md-example-child md-example-child-stepper md-example-child-stepper-4">
<md-field>
<md-field-item
name="arrow4"
title="最小值4大于默认值"
customized
align="right">
<div class="normal-tip">
<md-stepper
:min="4"
></md-stepper>
</div>
</md-field-item>
</md-field>
</div>
</template>
<script>
import {Stepper, Field, FieldItem} from 'mand-mobile'
export default {
name: 'stepper-demo',
components: {
[Field.name]: Field,
[FieldItem.name]: FieldItem,
[Stepper.name]: Stepper,
},
}
</script>
只读
<template>
<div class="md-example-child md-example-child-stepper md-example-child-stepper-1">
<md-field>
<md-field-item
name="arrow2"
title="只读"
customized
align="right">
<div class="normal-tip">
<md-stepper
read-only
></md-stepper>
</div>
</md-field-item>
</md-field>
</div>
</template>
<script>
import {Stepper, Field, FieldItem} from 'mand-mobile'
export default {
name: 'stepper-demo',
components: {
[Field.name]: Field,
[FieldItem.name]: FieldItem,
[Stepper.name]: Stepper,
},
}
</script>
步进2
<template>
<div class="md-example-child md-example-child-stepper md-example-child-stepper-3">
<md-field>
<md-field-item
name="arrow4"
title="步进2, 只允许输入整数"
customized
align="right">
<div class="normal-tip">
<md-stepper
v-model="value"
:step="2"
:min="2"
is-integer
></md-stepper>
</div>
</md-field-item>
</md-field>
</div>
</template>
<script>
import {Stepper, Field, FieldItem} from 'mand-mobile'
export default {
name: 'stepper-demo',
components: {
[Field.name]: Field,
[FieldItem.name]: FieldItem,
[Stepper.name]: Stepper,
},
data() {
return {
value: 3,
}
},
}
</script>
step为小数1.3
<template>
<div class="md-example-child md-example-child-stepper md-example-child-stepper-5">
<md-field>
<md-field-item
name="arrow5"
title="step为小数1.3"
customized
align="right">
<div class="normal-tip">
<md-stepper
:step="1.3"
></md-stepper>
</div>
</md-field-item>
</md-field>
</div>
</template>
<script>
import {Stepper, Field, FieldItem} from 'mand-mobile'
export default {
name: 'stepper-demo',
components: {
[Field.name]: Field,
[FieldItem.name]: FieldItem,
[Stepper.name]: Stepper,
},
}
</script>
API
Stepper Props
属性 | 说明 | 类型 | 默认值 |
---|---|---|---|
v-model1.5.3+ | 当前值 | Number/String | - |
default-value | 默认值 | Number/String | - |
step | 每次改变步数,可以为小数 | Number/String | 1 |
min | 最小值 | Number/String | -Infinity |
max | 最大值 | Number/String | Infinity |
disabled | 禁用 | Boolean | false |
read-only | 只读 | Boolean | false |
is-integer1.5.3+ | 只能输入整数 | Boolean | false |
Stepper Events
@change(currentValue)
值发生变化事件