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