Newer
Older
<div v-if="editedKeyboard">
<a title="Back to keyboards" href="#" v-on:click="editedKeyboard = null">
⏴
</a>
<span>{{ editedKeyboard.name }}</span>
<KeyboardConfiguration :keyboard="editedKeyboard" />
</div>
<div v-else-if="selectedKeyboard">
<a
title="Back to keyboards"
href="#"
v-on:click="selectedKeyboard = null"
⏴
</a>
<span>{{ selectedKeyboard.name }}</span>
<KeyboardDisplay :keyboard="selectedKeyboard" />
</div>
<div v-else>
<strong>Keyboards manager</strong>
<hr />
<table class="keyboards">
<thead>
<tr>
<th>Keyboard</th>
<th>No. of keys</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<tr v-for="k in keyboards" :key="k.name">
<td>
<a href="#" v-on:click="selectedKeyboard = k">{{ k.name }}</a>
</td>
<td>{{ k.characters.length }}</td>
<td>
<button type="button" v-on:click="editedKeyboard = k">
Edit
</button>
</td>
</tr>
</tbody>
</table>
import { mapState } from "vuex";
import KeyboardConfiguration from "./KeyboardConfiguration.vue";
import KeyboardDisplay from "./KeyboardDisplay.vue";
export default {
components: {
KeyboardConfiguration,
computed: {
...mapState(["keyboards"]),
},