Gitlab@Informatics

Skip to content
Snippets Groups Projects
Commit f825df41 authored by 62160286's avatar 62160286
Browse files

Add computed result

parent 8523b256
No related branches found
No related tags found
No related merge requests found
<template> <template>
<div> <div>
<div v-if="finish"> <div v-if="finish">
<span v-if="winner !== '-'">{{ winner }} Win!!! </span> <!-- <span v-if="winner !== '-'">{{ winner }} Win!!! </span>
<span v-else>Draw!!! </span> <span v-else>Draw!!! </span> -->
<span>{{ result }}</span>
<button @click="newGame">New Game</button> <button @click="newGame">New Game</button>
</div> </div>
<div v-else>{{ turn }} Turn..</div> <div v-else>{{ turn }} Turn..</div>
...@@ -36,6 +37,15 @@ export default { ...@@ -36,6 +37,15 @@ export default {
] ]
} }
}, },
computed: {
result () {
if (this.finish && this.winner === '-') {
return 'Draw!!! '
} else {
return this.turn + ' Win!!! '
}
}
},
methods: { methods: {
newGame () { newGame () {
this.count = 0 this.count = 0
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment