2
0
mirror of https://github.com/tenrok/vue-form-wizard.git synced 2026-06-23 12:40:33 +03:00

#22 Initial support for vertical tabs

This commit is contained in:
cristijora
2017-09-27 22:53:50 +03:00
parent 74f04a52b2
commit 0cdc0485d8
3 changed files with 37 additions and 4 deletions
+6 -1
View File
@@ -7,7 +7,8 @@
<form-wizard @on-complete="onComplete" <form-wizard @on-complete="onComplete"
@on-change="handleChange" @on-change="handleChange"
:start-index.sync="activeIndex" :start-index.sync="activeIndex"
shape="tab" layout="vertical"
steps-classes="steps-size"
color="#e74c3c"> color="#e74c3c">
<tab-content v-for="tab in tabs" :title="tab" :key="tab">{{tab}}</tab-content> <tab-content v-for="tab in tabs" :title="tab" :key="tab">{{tab}}</tab-content>
<transition name="fade" mode="out-in"> <transition name="fade" mode="out-in">
@@ -66,6 +67,10 @@
@import "loader.css"; @import "loader.css";
</style> </style>
<style lang="scss"> <style lang="scss">
.steps-size{
width: 200px;
height: 400px;
}
$border-radius-extreme: 6px !default; $border-radius-extreme: 6px !default;
$white-color: white; $white-color: white;
$gray-input-bg: #F3F2EE !default; $gray-input-bg: #F3F2EE !default;
+17
View File
@@ -125,4 +125,21 @@
} }
} }
} }
&.vertical {
.wizard-card-footer {
display: block;
}
.wizard-nav-pills {
flex-direction: column;
}
.wizard-navigation {
display: flex;
flex-direction: row;
}
.wizard-card-footer {
padding-top: 30px;
}
}
} }
+14 -3
View File
@@ -1,5 +1,5 @@
<template> <template>
<div class="vue-form-wizard" :class="stepSize" @keyup.right="focusNextTab" @keyup.left="focusPrevTab"> <div class="vue-form-wizard" :class="[stepSize, {vertical: isVertical}]" @keyup.right="focusNextTab" @keyup.left="focusPrevTab">
<div class="wizard-header"> <div class="wizard-header">
<slot name="title"> <slot name="title">
<h4 class="wizard-title">{{title}}</h4> <h4 class="wizard-title">{{title}}</h4>
@@ -7,11 +7,11 @@
</slot> </slot>
</div> </div>
<div class="wizard-navigation"> <div class="wizard-navigation">
<div class="wizard-progress-with-circle"> <div class="wizard-progress-with-circle" v-if="!isVertical">
<div class="wizard-progress-bar" <div class="wizard-progress-bar"
:style="progressBarStyle"></div> :style="progressBarStyle"></div>
</div> </div>
<ul class="wizard-nav wizard-nav-pills" role="tablist"> <ul class="wizard-nav wizard-nav-pills" role="tablist" :class="stepsClasses">
<slot name="step" v-for="(tab, index) in tabs" <slot name="step" v-for="(tab, index) in tabs"
:tab="tab" :tab="tab"
:index="index" :index="index"
@@ -122,6 +122,14 @@
type: String, type: String,
default: 'circle' default: 'circle'
}, },
layout: {
type: String,
default: 'horizontal'
},
stepsClasses: {
type: [String, Array],
default: ''
},
stepSize: { stepSize: {
type: String, type: String,
default: 'md', default: 'md',
@@ -174,6 +182,9 @@
isLastStep () { isLastStep () {
return this.activeTabIndex === this.tabCount - 1 return this.activeTabIndex === this.tabCount - 1
}, },
isVertical () {
return this.layout === 'vertical'
},
displayPrevButton () { displayPrevButton () {
return this.activeTabIndex !== 0 return this.activeTabIndex !== 0
}, },