Stepper 步进器

Scan me!

增加,减少或修改当前数值

引入

  1. import { Stepper } from 'mand-mobile'
  2. Vue.component(Stepper.name, Stepper)

代码演示

禁用

  1. <template>
  2. <div class="md-example-child md-example-child-stepper md-example-child-stepper-0">
  3. <md-field>
  4. <md-field-item
  5. name="arrow1"
  6. title="禁用"
  7. customized
  8. align="right">
  9. <div class="normal-tip">
  10. <md-stepper
  11. disabled
  12. ></md-stepper>
  13. </div>
  14. </md-field-item>
  15. </md-field>
  16. </div>
  17. </template>
  18. <script>
  19. import {Stepper, Field, FieldItem} from 'mand-mobile'
  20. export default {
  21. name: 'stepper-demo',
  22. components: {
  23. [Field.name]: Field,
  24. [FieldItem.name]: FieldItem,
  25. [Stepper.name]: Stepper,
  26. },
  27. }
  28. </script>

最小值-12,最大值18

  1. <template>
  2. <div class="md-example-child md-example-child-stepper md-example-child-stepper-2">
  3. <md-field>
  4. <md-field-item
  5. name="arrow3"
  6. title="最小值-12,最大值18"
  7. customized
  8. align="right">
  9. <div class="normal-tip">
  10. <md-stepper
  11. v-model="value"
  12. min="-12"
  13. max="18"
  14. ></md-stepper>
  15. </div>
  16. </md-field-item>
  17. </md-field>
  18. </div>
  19. </template>
  20. <script>
  21. import {Stepper, Field, FieldItem} from 'mand-mobile'
  22. export default {
  23. name: 'stepper-demo',
  24. components: {
  25. [Field.name]: Field,
  26. [FieldItem.name]: FieldItem,
  27. [Stepper.name]: Stepper,
  28. },
  29. data() {
  30. return {
  31. value: 0,
  32. }
  33. },
  34. }
  35. </script>

最小值4大于默认值

  1. <template>
  2. <div class="md-example-child md-example-child-stepper md-example-child-stepper-4">
  3. <md-field>
  4. <md-field-item
  5. name="arrow4"
  6. title="最小值4大于默认值"
  7. customized
  8. align="right">
  9. <div class="normal-tip">
  10. <md-stepper
  11. :min="4"
  12. ></md-stepper>
  13. </div>
  14. </md-field-item>
  15. </md-field>
  16. </div>
  17. </template>
  18. <script>
  19. import {Stepper, Field, FieldItem} from 'mand-mobile'
  20. export default {
  21. name: 'stepper-demo',
  22. components: {
  23. [Field.name]: Field,
  24. [FieldItem.name]: FieldItem,
  25. [Stepper.name]: Stepper,
  26. },
  27. }
  28. </script>

只读

  1. <template>
  2. <div class="md-example-child md-example-child-stepper md-example-child-stepper-1">
  3. <md-field>
  4. <md-field-item
  5. name="arrow2"
  6. title="只读"
  7. customized
  8. align="right">
  9. <div class="normal-tip">
  10. <md-stepper
  11. read-only
  12. ></md-stepper>
  13. </div>
  14. </md-field-item>
  15. </md-field>
  16. </div>
  17. </template>
  18. <script>
  19. import {Stepper, Field, FieldItem} from 'mand-mobile'
  20. export default {
  21. name: 'stepper-demo',
  22. components: {
  23. [Field.name]: Field,
  24. [FieldItem.name]: FieldItem,
  25. [Stepper.name]: Stepper,
  26. },
  27. }
  28. </script>

步进2

  1. <template>
  2. <div class="md-example-child md-example-child-stepper md-example-child-stepper-3">
  3. <md-field>
  4. <md-field-item
  5. name="arrow4"
  6. title="步进2, 只允许输入整数"
  7. customized
  8. align="right">
  9. <div class="normal-tip">
  10. <md-stepper
  11. v-model="value"
  12. :step="2"
  13. :min="2"
  14. is-integer
  15. ></md-stepper>
  16. </div>
  17. </md-field-item>
  18. </md-field>
  19. </div>
  20. </template>
  21. <script>
  22. import {Stepper, Field, FieldItem} from 'mand-mobile'
  23. export default {
  24. name: 'stepper-demo',
  25. components: {
  26. [Field.name]: Field,
  27. [FieldItem.name]: FieldItem,
  28. [Stepper.name]: Stepper,
  29. },
  30. data() {
  31. return {
  32. value: 3,
  33. }
  34. },
  35. }
  36. </script>

step为小数1.3

  1. <template>
  2. <div class="md-example-child md-example-child-stepper md-example-child-stepper-5">
  3. <md-field>
  4. <md-field-item
  5. name="arrow5"
  6. title="step为小数1.3"
  7. customized
  8. align="right">
  9. <div class="normal-tip">
  10. <md-stepper
  11. :step="1.3"
  12. ></md-stepper>
  13. </div>
  14. </md-field-item>
  15. </md-field>
  16. </div>
  17. </template>
  18. <script>
  19. import {Stepper, Field, FieldItem} from 'mand-mobile'
  20. export default {
  21. name: 'stepper-demo',
  22. components: {
  23. [Field.name]: Field,
  24. [FieldItem.name]: FieldItem,
  25. [Stepper.name]: Stepper,
  26. },
  27. }
  28. </script>

API

Stepper Props

属性说明类型默认值
v-model1.5.3+当前值Number/String-
default-value默认值Number/String-
step每次改变步数,可以为小数Number/String1
min最小值Number/String-Infinity
max最大值Number/StringInfinity
disabled禁用Booleanfalse
read-only只读Booleanfalse
is-integer1.5.3+只能输入整数Booleanfalse

Stepper Events

@change(currentValue)

值发生变化事件