vue-good-wizard
An easy and clean VueJS 2.x wizard plugin.
Getting Started
Prerequisites
The plugin is meant to be used with existing VueJS 2.x projects.
Installing
Install with npm:
npm install --save vue-good-wizard
import into project:
import Vue from 'vue';
import VueGoodWizard from 'vue-good-wizard';
Vue.use(VueGoodWizard);
Example Usage
This should result in the screenshot seen above
Component Options
Option | Description | Type, Example |
---|---|---|
steps (required) | Array of objects that specify step titles and page id |
[
{
label: 'Add Constraints', // title for wizard step
page: 'page2', //id for div to show for this step
},
//...
]
|
onNext (optional) | function called before next page is shown. This is a good place to do validation etc. Return true to proceed, or false to stay on the same page. |
function ex:
function(currentPage){
console.log(currentPage);
return true;
}
|
onBack (optional) | function called before previous page is shown. Return true to proceed, or false to stay on the same page. |
function ex:
function(currentPage){
console.log(currentPage);
return true;
}
|
Label options | ||
previousStepLabel | label for previous step | default: 'Back' |
nextStepLabel | label for next step | default: 'Next' |
finalStepLabel | label for final step | default: 'Save' |
Advanced usecase - Call next or back asynchronously
In some cases, you might want to change step programmatically. The most common usecase for this is if you want to call an asynchronous action on next/back click and then in the callback want to either go to the next step or stay on the same step.
Following is an example of how this can be done using vue-good-wizard