Gitlab@Informatics

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

Create OXCell

parent 910f6afa
Branches
No related tags found
No related merge requests found
<template>
<div @click="clickCell">{{ player }}</div>
</template>
<script>
export default {
props: ['player', 'row', 'col'],
methods: {
clickCell (event) {
console.log(event)
console.log('click ' + this.row + ' ' + this.col)
this.$emit('cell-click', this.row, this.col)
}
}
}
</script>
<style></style>
<template> <template>
<div> <div>
<table> <table>
<tr> <tr v-for="(line, lineId) in table" :key="lineId">
<td>-</td> <td v-for="(item, itemId) in line" :key="itemId">
<td>-</td> <OXCell :player="item" :row="lineId" :col="itemId" @cell-click="cellClick" />
<td>-</td> </td>
</tr>
<tr>
<td>-</td>
<td>-</td>
<td>-</td>
</tr>
<tr>
<td>-</td>
<td>-</td>
<td>-</td>
</tr> </tr>
</table> </table>
</div> </div>
</template> </template>
<script> <script>
export default {} import OXCell from './OXCell.vue'
export default {
data () {
return {
turn: 'O',
table: [
['-', '-', '-'],
['-', '-', '-'],
['-', '-', '-']
]
}
},
methods: {
cellClick (row, col) {
console.log('Cell click ' + row + ' ' + col)
this.table[row][col] = this.turn
}
},
components: {
OXCell
}
}
</script> </script>
<style></style> <style></style>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment