My variable, transitionName, is not changing in the beforeLeaveHook. The value of transitionName remains to be 'right' when it should change to 'left'. Please help.
<template lang="pug">
transition(:name="transitionName" v-on:before-leave="beforeLeaveHook")
.componentMain
h1 {{transitionName}}
</template>
<script>
export default {
name: 'Component',
data () {
return {
transitionName: 'right',
}
},
methods: {
beforeLeaveHook: function(event){
this.transitionName = 'left';
}
}
}
</script>
before-leave
attribute? – PatrickSteele