Stepper - 图1

Stepper Vue Component

Stepper Vue component represents Stepper component.

Stepper Components

There are following components included:

  • **f7-stepper**

Stepper Properties

PropTypeDefaultDescription
<f7-stepper> properties
initbooleantrueInitializes Stepper
valuenumber0Stepper value
minnumber0Minimum value
maxnumber100Maximum value
stepnumber1Maximum value
wrapsbooleanfalseWhen enabled, incrementing beyond maximum value sets value to minimum value; likewise, decrementing below minimum value sets value to maximum value
autorepeatbooleanfalseWhen enabled it will repeatedly increase/decrease values while you tap and hold plus/minus buttons
autorepeat-dynamicbooleanfalseWhen enabled it will increase autorepeat ratio based on how long you hold the button
inputbooleantrueDefines should it render <input> element or not
input-readonlybooleanfalseMakes inner input element readonly
buttons-onlybooleanfalseDisables inner value container between stepper buttons
format-valuefunction(value)Custom function to format value for value element between buttons. It must return new formatted value
manual-input-modebooleanfalseEnables manual input mode. This mode allows to type value from keyboar and check fractional part with defined accurancy. Also, step parameter is ignored when typing in this mode.
decimal-pointnumber4Number of digits after dot, when in manual input mode.
buttons-end-input-modebooleantrueDisables manual input mode on Stepper’s minus or plus button click.
disabledbooleanfalseDefines whether the stepper is disabled or not
roundbooleanfalseMakes stepper round
round-iosbooleanfalseMakes stepper round for iOS theme only
round-mdbooleanfalseMakes stepper round for MD theme only
bigbooleanfalseMakes big stepper
big-iosbooleanfalseMakes big stepper for iOS theme only
big-mdbooleanfalseMakes big stepper for MD theme only
smallbooleanfalseMakes small stepper
small-iosbooleanfalseMakes small stepper for iOS theme only
small-mdbooleanfalseMakes small stepper for MD theme only
fillbooleanfalseMakes stepper filled color
fill-iosbooleanfalseMakes stepper filled color for iOS theme only
fill-mdbooleanfalseMakes stepper filled color for MD theme only
raisedbooleanfalseMakes stepper raised. Affects MD theme only

Stepper Events

EventDescription
<f7-stepper> events
stepper:changeEvent will be triggered when Stepper value has been changed
stepper:minusclickEvent will be triggered on “minus” button click
stepper:plusclickEvent will be triggered on “plus” button click
inputEvent will be triggered on input’s input event

Stepper Methods

EventDescription
<f7-stepper> methods
.increment()Increment stepper value, similar to clicking on its “plus” button
.decremenet()Decrement stepper value, similar to clicking on its “minus” button
.setValue(newValue)Set new stepper value
.getValue()Returns stepper value

Examples

  1. <template>
  2. <f7-page>
  3. <f7-navbar title="Stepper"></f7-navbar>
  4. <f7-block-title>Shape and size</f7-block-title>
  5. <f7-block strong class="text-align-center">
  6. <f7-row>
  7. <f7-col>
  8. <small class="display-block">Default</small>
  9. <f7-stepper></f7-stepper>
  10. </f7-col>
  11. <f7-col>
  12. <small class="display-block">Round</small>
  13. <f7-stepper round></f7-stepper>
  14. </f7-col>
  15. </f7-row>
  16. <f7-row class="margin-top">
  17. <f7-col>
  18. <small class="display-block">Fill</small>
  19. <f7-stepper fill></f7-stepper>
  20. </f7-col>
  21. <f7-col>
  22. <small class="display-block">Round Fill</small>
  23. <f7-stepper fill round></f7-stepper>
  24. </f7-col>
  25. </f7-row>
  26. <f7-row class="margin-top">
  27. <f7-col>
  28. <small class="display-block">Small</small>
  29. <f7-stepper small></f7-stepper>
  30. </f7-col>
  31. <f7-col>
  32. <small class="display-block">Small Round</small>
  33. <f7-stepper small round></f7-stepper>
  34. </f7-col>
  35. </f7-row>
  36. <f7-row class="margin-top">
  37. <f7-col>
  38. <small class="display-block">Small Fill</small>
  39. <f7-stepper small fill></f7-stepper>
  40. </f7-col>
  41. <f7-col>
  42. <small class="display-block">Small Round Fill</small>
  43. <f7-stepper small round fill></f7-stepper>
  44. </f7-col>
  45. </f7-row>
  46. <f7-row class="margin-top">
  47. <f7-col>
  48. <small class="display-block">Big</small>
  49. <f7-stepper big></f7-stepper>
  50. </f7-col>
  51. <f7-col>
  52. <small class="display-block">Big Round</small>
  53. <f7-stepper big round></f7-stepper>
  54. </f7-col>
  55. </f7-row>
  56. <f7-row class="margin-top">
  57. <f7-col>
  58. <small class="display-block">Big Fill</small>
  59. <f7-stepper big fill></f7-stepper>
  60. </f7-col>
  61. <f7-col>
  62. <small class="display-block">Big Round Fill</small>
  63. <f7-stepper big round fill></f7-stepper>
  64. </f7-col>
  65. </f7-row>
  66. </f7-block>
  67. <f7-block-title>Raised (MD-theme only)</f7-block-title>
  68. <f7-block strong class="text-align-center">
  69. <f7-row>
  70. <f7-col>
  71. <small class="display-block">Default</small>
  72. <f7-stepper raised></f7-stepper>
  73. </f7-col>
  74. <f7-col>
  75. <small class="display-block">Round</small>
  76. <f7-stepper raised round></f7-stepper>
  77. </f7-col>
  78. </f7-row>
  79. <f7-row class="margin-top">
  80. <f7-col>
  81. <small class="display-block">Fill</small>
  82. <f7-stepper raised fill></f7-stepper>
  83. </f7-col>
  84. <f7-col>
  85. <small class="display-block">Round Fill</small>
  86. <f7-stepper raised fill round></f7-stepper>
  87. </f7-col>
  88. </f7-row>
  89. <f7-row class="margin-top">
  90. <f7-col>
  91. <small class="display-block">Small</small>
  92. <f7-stepper raised small></f7-stepper>
  93. </f7-col>
  94. <f7-col>
  95. <small class="display-block">Small Round</small>
  96. <f7-stepper raised small round></f7-stepper>
  97. </f7-col>
  98. </f7-row>
  99. <f7-row class="margin-top">
  100. <f7-col>
  101. <small class="display-block">Small Fill</small>
  102. <f7-stepper raised small fill></f7-stepper>
  103. </f7-col>
  104. <f7-col>
  105. <small class="display-block">Small Round Fill</small>
  106. <f7-stepper raised small round fill></f7-stepper>
  107. </f7-col>
  108. </f7-row>
  109. <f7-row class="margin-top">
  110. <f7-col>
  111. <small class="display-block">Big</small>
  112. <f7-stepper raised big></f7-stepper>
  113. </f7-col>
  114. <f7-col>
  115. <small class="display-block">Big Round</small>
  116. <f7-stepper raised big round></f7-stepper>
  117. </f7-col>
  118. </f7-row>
  119. <f7-row class="margin-top">
  120. <f7-col>
  121. <small class="display-block">Big Fill</small>
  122. <f7-stepper raised big fill></f7-stepper>
  123. </f7-col>
  124. <f7-col>
  125. <small class="display-block">Big Round Fill</small>
  126. <f7-stepper raised big round fill></f7-stepper>
  127. </f7-col>
  128. </f7-row>
  129. </f7-block>
  130. <f7-block-title>Colors</f7-block-title>
  131. <f7-block strong class="text-align-center">
  132. <f7-row>
  133. <f7-col>
  134. <f7-stepper fill color="red"></f7-stepper>
  135. </f7-col>
  136. <f7-col>
  137. <f7-stepper fill round color="green"></f7-stepper>
  138. </f7-col>
  139. </f7-row>
  140. <f7-row class="margin-top">
  141. <f7-col>
  142. <f7-stepper fill color="blue"></f7-stepper>
  143. </f7-col>
  144. <f7-col>
  145. <f7-stepper fill round color="pink"></f7-stepper>
  146. </f7-col>
  147. </f7-row>
  148. <f7-row class="margin-top">
  149. <f7-col>
  150. <f7-stepper fill small color="yellow"></f7-stepper>
  151. </f7-col>
  152. <f7-col>
  153. <f7-stepper fill small round color="orange"></f7-stepper>
  154. </f7-col>
  155. </f7-row>
  156. <f7-row class="margin-top">
  157. <f7-col>
  158. <f7-stepper fill small color="gray"></f7-stepper>
  159. </f7-col>
  160. <f7-col>
  161. <f7-stepper fill small round color="black"></f7-stepper>
  162. </f7-col>
  163. </f7-row>
  164. </f7-block>
  165. <f7-block-title>Without input element</f7-block-title>
  166. <f7-block strong class="text-align-center">
  167. <f7-row>
  168. <f7-col>
  169. <f7-stepper :input="false"></f7-stepper>
  170. </f7-col>
  171. <f7-col>
  172. <f7-stepper :input="false" round></f7-stepper>
  173. </f7-col>
  174. </f7-row>
  175. </f7-block>
  176. <f7-block-title>Min, max, step</f7-block-title>
  177. <f7-block strong class="text-align-center">
  178. <f7-row>
  179. <f7-col>
  180. <f7-stepper :value="100" :min="0" :max="1000" :step="100"></f7-stepper>
  181. </f7-col>
  182. <f7-col>
  183. <f7-stepper :input="false" :value="5" :min="0" :max="10" :step="0.5"></f7-stepper>
  184. </f7-col>
  185. </f7-row>
  186. </f7-block>
  187. <f7-block-title>Autorepeat (Tap & hold)</f7-block-title>
  188. <f7-block-header>Pressing and holding one of its buttons increments or decrements the stepper’s value repeatedly. With dynamic autorepeat, the rate of change depends on how long the user continues pressing the control.</f7-block-header>
  189. <f7-block strong class="text-align-center">
  190. <f7-row>
  191. <f7-col>
  192. <small class="display-block">Default</small>
  193. <f7-stepper :value="0" :min="0" :max="100" :step="1" :autorepeat="true"></f7-stepper>
  194. </f7-col>
  195. <f7-col>
  196. <small class="display-block">Dynamic</small>
  197. <f7-stepper :value="0" :min="0" :max="100" :step="1" :autorepeat="true" :autorepeat-dynamic="true"></f7-stepper>
  198. </f7-col>
  199. </f7-row>
  200. </f7-block>
  201. <f7-block-title>Wraps</f7-block-title>
  202. <f7-block-header>In wraps mode incrementing beyond maximum value sets value to minimum value, likewise, decrementing below minimum value sets value to maximum value</f7-block-header>
  203. <f7-block strong class="text-align-center">
  204. <f7-row>
  205. <f7-col>
  206. <f7-stepper :value="0" :min="0" :max="10" :step="1" :autorepeat="true" :wraps="true"></f7-stepper>
  207. </f7-col>
  208. </f7-row>
  209. </f7-block>
  210. <f7-block-title>Custom value element</f7-block-title>
  211. <f7-list>
  212. <f7-list-item :title="`Apples ${applesCount}`">
  213. <f7-stepper :buttons-only="true" small raised slot="after" @stepper:change="setApples"></f7-stepper>
  214. </f7-list-item>
  215. <f7-list-item :title="`Oranges ${orangesCount}`">
  216. <f7-stepper :buttons-only="true" small raised slot="after" @stepper:change="setOranges"></f7-stepper>
  217. </f7-list-item>
  218. </f7-list>
  219. <f7-block-title>Custom value format</f7-block-title>
  220. <f7-list>
  221. <f7-list-item header="Meeting starts in" :title="meetingTimeComputed">
  222. <f7-stepper
  223. :min="15"
  224. :max="240"
  225. :step="15"
  226. :value="meetingTime"
  227. :buttons-only="true"
  228. small
  229. slot="after"
  230. @stepper:change="setMeetingTime"
  231. ></f7-stepper>
  232. </f7-list-item>
  233. </f7-list>
  234. <f7-block-title>Manual input</f7-block-title>
  235. <f7-block-header>It is possible to enter value manually from keyboard or mobile keypad. When click on input field, stepper enter into manual input mode, which allow type value from keyboar and check fractional part with defined accurancy. Click outside or enter Return key, ending manual mode.</f7-block-header>
  236. <f7-block strong class="text-align-center">
  237. <f7-row>
  238. <f7-col>
  239. <f7-stepper fill :value="0" :min="0" :max="1000" :step="1" :autorepeat="true" :wraps="true" :manual-input-mode="true" :decimal-point="2"></f7-stepper>
  240. </f7-col>
  241. </f7-row>
  242. </f7-block>
  243. </f7-page>
  244. </template>
  245. <script>
  246. export default {
  247. data() {
  248. return {
  249. applesCount: 0,
  250. orangesCount: 0,
  251. meetingTime: 15,
  252. };
  253. },
  254. computed: {
  255. meetingTimeComputed() {
  256. const self = this;
  257. const value = self.meetingTime;
  258. const hours = Math.floor(value / 60);
  259. const minutes = value - (hours * 60);
  260. const formatted = [];
  261. if (hours > 0) {
  262. formatted.push(hours + ' ' + (hours > 1 ? 'hours' : 'hour'));
  263. }
  264. if (minutes > 0) {
  265. formatted.push(minutes + ' minutes');
  266. }
  267. return formatted.join(' ');
  268. },
  269. },
  270. methods: {
  271. setApples(value) {
  272. this.applesCount = value;
  273. },
  274. setOranges(value) {
  275. this.orangesCount = value;
  276. },
  277. setMeetingTime(value) {
  278. this.meetingTime = value;
  279. },
  280. },
  281. };
  282. </script>