Skip to content

Instantly share code, notes, and snippets.

@daphen
Created February 25, 2016 11:45
Show Gist options
  • Save daphen/1f929ad4a8e3bd122c1e to your computer and use it in GitHub Desktop.
Save daphen/1f929ad4a8e3bd122c1e to your computer and use it in GitHub Desktop.
<template lang="jade">
component(:is="currentStep", transition="switch-step", transition-mode="out-in")
button.stepButton(@click="setCurrentStep('step1')") Step 1
button.stepButton(@click="setCurrentStep('step2')") Step 2
</template>
<style lang="stylus">
h1
color: #33BA82
background-color: #33495F
text-align center
width: 50%
margin: auto
button
margin-top: 15px
.switch-step-transition
transition: all .3s ease
.switch-step-enter
transform: translateX(50%)
opacity: 0
.switch-step-leave
transform: translateX(-50%)
opacity: 0
</style>
<script>
var Step1 = require('./regflow/step1.vue'),
Step2 = require('./regflow/step2.vue');
export default {
data: function () {
return {
currentStep: 'step1'
}
},
methods: {
setCurrentStep: function(step) {
this.currentStep = step;
}
},
components: {
step1: Step1,
step2: Step2
}
}
</script>
<template lang="jade">
#step1(:stepManager="stepManager")
h1 {{msg}}
</template>
<style lang="stylus">
</style>
<script>
export default {
data: function () {
return {
msg: 'Hello World Step 1'
}
},
props: ['stepHandler']
}
</script>
<template lang="jade">
h1 {{msg}}
</template>
<style lang="stylus">
</style>
<script>
export default {
data: function () {
return {
msg: 'Hello World Step 2'
}
}
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment