2
0
mirror of https://github.com/tenrok/vue-form-wizard.git synced 2026-06-24 07:10:33 +03:00

Add slots to WizardStep

This commit is contained in:
cristijora
2017-07-31 21:57:23 +03:00
parent 81b69507f5
commit 77a16bb350
3 changed files with 26 additions and 15 deletions
+7 -2
View File
@@ -12,7 +12,7 @@
class="card" ref="wizard"> class="card" ref="wizard">
<template slot="step" scope="props"> <template slot="step" scope="props">
<wizard-step :tab="props.tab" <wizard-step :tab="props.tab"
:transition="props.transition" transition="fade"
:key="props.tab.title" :key="props.tab.title"
:index="props.index"> :index="props.index">
</wizard-step> </wizard-step>
@@ -103,5 +103,10 @@
position: relative; position: relative;
z-index: 1; z-index: 1;
} }
.fade-enter-active, .fade-leave-active {
transition: opacity .2s
}
.fade-enter, .fade-leave-to /* .fade-leave-active in <2.1.8 */ {
opacity: 0
}
</style> </style>
-1
View File
@@ -20,7 +20,6 @@
<wizard-step :tab="tab" <wizard-step :tab="tab"
@click.native="navigateToTab(index)" @click.native="navigateToTab(index)"
:transition="transition" :transition="transition"
:key="tab.title"
:index="index"> :index="index">
</wizard-step> </wizard-step>
</slot> </slot>
+19 -12
View File
@@ -6,22 +6,29 @@
:style="[tab.checked ? stepCheckedStyle : {}, tab.validationError ? errorStyle : {}]"> :style="[tab.checked ? stepCheckedStyle : {}, tab.validationError ? errorStyle : {}]">
<transition :name="transition" mode="out-in"> <transition :name="transition" mode="out-in">
<div v-if="tab.active" class="wizard-icon-container"
:class="{square_shape:isStepSquare, tab_shape:isTabShape}" <div v-if="tab.active" class="wizard-icon-container"
:style="[tab.active ? iconActiveStyle: {}, tab.validationError ? errorStyle : {}]"> :class="{square_shape:isStepSquare, tab_shape:isTabShape}"
<i v-if="tab.icon" :class="tab.icon" class="wizard-icon"></i> :style="[tab.active ? iconActiveStyle: {}, tab.validationError ? errorStyle : {}]">
<i v-else class="wizard-icon">{{index + 1}}</i> <slot name="active-step">
</div> <i v-if="tab.icon" :class="tab.icon" class="wizard-icon"></i>
<i v-if="!tab.active && tab.icon" :class="tab.icon" class="wizard-icon"></i> <i v-else class="wizard-icon">{{index + 1}}</i>
<i v-if="!tab.active && !tab.icon" class="wizard-icon">{{index + 1}}</i> </slot>
</div>
<slot v-if="!tab.active">
<i v-if="!tab.active && tab.icon" :class="tab.icon" class="wizard-icon"></i>
<i v-if="!tab.active && !tab.icon" class="wizard-icon">{{index + 1}}</i>
</slot>
</transition> </transition>
</div> </div>
<span class="stepTitle" <slot name="title">
:class="{active:tab.active, has_error:tab.validationError}" <span class="stepTitle"
:style="tab.active ? stepTitleStyle : {}"> :class="{active:tab.active, has_error:tab.validationError}"
:style="tab.active ? stepTitleStyle : {}">
{{tab.title}} {{tab.title}}
</span> </span>
</slot>
</a> </a>
</li> </li>
</template> </template>