| 1 | Vue.component("my-game-list", { |
| 2 | props: ["games"], |
| 3 | computed: { |
| 4 | showResult: function() { |
| 5 | this.games.length > 0 && this.games[0].score != "*"; |
| 6 | }, |
| 7 | }, |
| 8 | template: ` |
| 9 | <table> |
| 10 | <tr> |
| 11 | <th>Players names</th> |
| 12 | <th>Cadence</th> |
| 13 | <th v-if="showResult"> |
| 14 | </tr> |
| 15 | <tr v-for="g in games" @click="$emit('show-game',g)"> |
| 16 | <td> |
| 17 | <span v-for="p in g.players">{{ p.name }}</span> |
| 18 | </td> |
| 19 | <td>{{ g.mainTime }} + {{ g.increment }}</td> |
| 20 | <td v-if="showResult">{{ g.score }}</td> |
| 21 | </tr> |
| 22 | </table> |
| 23 | `, |
| 24 | }); |