mirror of
https://github.com/tenrok/vue-form-wizard.git
synced 2026-06-23 13:20:33 +03:00
#27 Expose footer content as a scoped slot
This commit is contained in:
@@ -20,6 +20,13 @@
|
|||||||
<div v-if="error">
|
<div v-if="error">
|
||||||
{{error}}
|
{{error}}
|
||||||
</div>
|
</div>
|
||||||
|
<template slot="footer" scope="props">
|
||||||
|
<div class="wizard-footer-right">
|
||||||
|
<wizard-button :style="props.fillButtonStyle">Cancel</wizard-button>
|
||||||
|
<wizard-button @click.native="props.nextTab()" class="wizard-footer-right" :style="props.fillButtonStyle">Next</wizard-button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</template>
|
||||||
</form-wizard>
|
</form-wizard>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -35,7 +35,6 @@
|
|||||||
:style="tab.active ? stepTitleStyle : {}">
|
:style="tab.active ? stepTitleStyle : {}">
|
||||||
{{tab.title}}
|
{{tab.title}}
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
@@ -46,44 +45,55 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="wizard-card-footer clearfix" v-if="!hideButtons">
|
<div class="wizard-card-footer clearfix" v-if="!hideButtons">
|
||||||
<template>
|
<slot name="footer"
|
||||||
|
:next-tab="nextTab"
|
||||||
|
:prev-tab="prevTab"
|
||||||
|
:active-tab-index="activeTabIndex"
|
||||||
|
:is-last-step="isLastStep"
|
||||||
|
:fill-button-style="fillButtonStyle">
|
||||||
|
|
||||||
|
<template>
|
||||||
<span @click="prevTab" v-if="displayPrevButton" class="wizard-footer-left">
|
<span @click="prevTab" v-if="displayPrevButton" class="wizard-footer-left">
|
||||||
<slot name="prev">
|
<slot name="prev">
|
||||||
<button type="button" class="wizard-btn btn-default wizard-btn-wd" :style="fillButtonStyle"
|
<wizard-button :style="fillButtonStyle"
|
||||||
:disabled="loading">
|
:disabled="loading">
|
||||||
{{backButtonText}}
|
{{backButtonText}}
|
||||||
</button>
|
</wizard-button>
|
||||||
</slot>
|
</slot>
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<span @click="finish" class="wizard-footer-right" v-if="isLastStep">
|
<span @click="finish" class="wizard-footer-right" v-if="isLastStep">
|
||||||
<slot name="finish">
|
<slot name="finish">
|
||||||
<button type="button" class="wizard-btn btn-fill wizard-btn-wd btn-next" :style="fillButtonStyle">
|
<wizard-button :style="fillButtonStyle">
|
||||||
{{finishButtonText}}
|
{{finishButtonText}}
|
||||||
</button>
|
</wizard-button>
|
||||||
</slot>
|
</slot>
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<span @click="nextTab" class="wizard-footer-right" v-if="!isLastStep">
|
<span @click="nextTab" class="wizard-footer-right" v-if="!isLastStep">
|
||||||
<slot name="next">
|
<slot name="next">
|
||||||
<button type="button" class="wizard-btn btn-fill wizard-btn-wd btn-next" :style="fillButtonStyle"
|
<wizard-button :style="fillButtonStyle"
|
||||||
:disabled="loading">
|
:disabled="loading">
|
||||||
{{nextButtonText}}
|
{{nextButtonText}}
|
||||||
</button>
|
</wizard-button>
|
||||||
</slot>
|
</slot>
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
|
</slot>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
|
import WizardButton from './WizardButton.vue'
|
||||||
export default{
|
export default{
|
||||||
name: 'form-wizard',
|
name: 'form-wizard',
|
||||||
|
components: {
|
||||||
|
WizardButton
|
||||||
|
},
|
||||||
props: {
|
props: {
|
||||||
title: {
|
title: {
|
||||||
type: String,
|
type: String,
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
<template>
|
||||||
|
<button type="button" class="wizard-btn btn-fill wizard-btn-wd">
|
||||||
|
<slot></slot>
|
||||||
|
</button>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
export default {}
|
||||||
|
</script>
|
||||||
|
<style>
|
||||||
|
</style>
|
||||||
+4
-1
@@ -1,9 +1,11 @@
|
|||||||
import FormWizard from './components/FormWizard.vue'
|
import FormWizard from './components/FormWizard.vue'
|
||||||
import TabContent from './components/TabContent.vue'
|
import TabContent from './components/TabContent.vue'
|
||||||
|
import WizardButton from './components/WizardButton.vue'
|
||||||
const VueFormWizard = {
|
const VueFormWizard = {
|
||||||
install (Vue) {
|
install (Vue) {
|
||||||
Vue.component('form-wizard', FormWizard)
|
Vue.component('form-wizard', FormWizard)
|
||||||
Vue.component('tab-content', TabContent)
|
Vue.component('tab-content', TabContent)
|
||||||
|
Vue.component('wizard-button', WizardButton)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Automatic installation if Vue has been added to the global scope.
|
// Automatic installation if Vue has been added to the global scope.
|
||||||
@@ -14,5 +16,6 @@ if (typeof window !== 'undefined' && window.Vue) {
|
|||||||
export default VueFormWizard
|
export default VueFormWizard
|
||||||
export {
|
export {
|
||||||
FormWizard,
|
FormWizard,
|
||||||
TabContent
|
TabContent,
|
||||||
|
WizardButton
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user