I am currently working on a memory game that needs to be initiated right after the page is loaded.
In order to start, I have to call createDeck() and showCards()
I've experimented with different approaches within the export default {} section such as:
created(){
this.createDeck(),
this.createShowCards()
},
and
mounted() {
this.fetchCards(), // also need to fetch the cards, this works okay...
this.createDeck(),
this.createShowCards()
console.log('component mounted')
},
The game functions properly when I manually click a start button:
<div class="text-center">
<button @click="startGame()" v-if="Object.keys(cards).length != 0">Start game</button>
</div>
I'm seeking assistance in understanding what I may be overlooking. Is there a way to automate the clicking of the button?