0👍
✅
You are now toggling your rollDice
function beforeMount, if you change this to created
the changes will be toggled correctly, also note that you will need to change toggleClasses
to this.toggleClasses
since it is defined in the methods section of your component and is therefore bound to the component and not a global function anymore.
I hope this helps you!
P.S. See my codepen for a working sample, note that I used a settimeout here for demo purposes, but you can adjust this to a @click="rollDice"
on a button within your component and leave out the mounted alltogether
Source:stackexchange.com