From 5262bd68885aa240db7c8f1798930a566f6a7167 Mon Sep 17 00:00:00 2001 From: Enzo Innocenzi Date: Wed, 6 Jul 2022 12:26:52 +0200 Subject: [PATCH] chore: update example with object declaration --- packages/core/useStepper/index.md | 47 +++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/packages/core/useStepper/index.md b/packages/core/useStepper/index.md index ffd4dc7f8fd..a813296b8d3 100644 --- a/packages/core/useStepper/index.md +++ b/packages/core/useStepper/index.md @@ -8,6 +8,8 @@ Provides helpers for building a multi-step wizard interface. ## Usage +### Steps as array + ```js import { useStepper } from '@vueuse/core' @@ -34,4 +36,49 @@ const { 'terms', 'payment', ]) + +// Access the step through `current` +console.log(current.value) // 'billing-address' +``` + +### Steps as object + +```js +import { useStepper } from '@vueuse/core' + +const { + steps, + stepNames, + index, + current, + next, + previous, + isFirst, + isLast, + goTo, + goNext, + goPrevious, + goBackTo, + isNext, + isPrevious, + isCurrent, + isBefore, + isAfter, +} = useStepper({ + 'user-information': { + title: 'User information', + }, + 'billing-address': { + title: 'Billing address', + }, + 'terms': { + title: 'Terms', + }, + 'payment': { + title: 'Payment', + }, +}) + +// Access the step object through `current` +console.log(current.value.title) // 'User information' ```