feat: cleanup and rework audio system
This commit is contained in:
35
client/src/views/SoundBoard.vue
Normal file
35
client/src/views/SoundBoard.vue
Normal file
@@ -0,0 +1,35 @@
|
||||
<template>
|
||||
<div class="sounds">
|
||||
<div :key="`sound-${sound.name}`" class="sound" v-for="sound in sounds">
|
||||
<h2 @click="emitSound(sound.name)">{{ sound.name }}</h2>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import axios from 'axios';
|
||||
|
||||
export default {
|
||||
name: 'SoundBoard',
|
||||
components: {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
sounds: [],
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
axios.get('/api/sounds')
|
||||
.then((response) => {
|
||||
this.sounds = response.data;
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
emitSound(soundName) {
|
||||
this.$socket.emit('playSound', soundName);
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
Reference in New Issue
Block a user