Skip to content

Commit

Permalink
add audio player
Browse files Browse the repository at this point in the history
  • Loading branch information
mushonnip committed Apr 17, 2022
1 parent 581deae commit 9908283
Showing 1 changed file with 30 additions and 1 deletion.
31 changes: 30 additions & 1 deletion src/views/Home.vue
Original file line number Diff line number Diff line change
@@ -1,3 +1,32 @@
<script setup>
import VoiceList from "../assets/generated-voice-list-id.json";
import { NCard, NButton, NSpace } from "naive-ui";
import { useI18n } from "vue-i18n";
const voices = VoiceList.voices;
const play = (category_path, item) => {
let audio = new Audio("voices/" + category_path + "/" + item.path);
audio.play();
};
const { locale } = useI18n();
</script>

<template>
<h1>Home</h1>
<div v-for="category in voices" v-bind:key="category.categoryName">
<n-card :title="category.categoryName">
<n-space>
<n-button
round
strong
secondary
type="info"
v-for="voiceItem in category.voiceList"
v-bind:key="voiceItem.name"
@click="play(category.categoryPath, voiceItem)"
>
{{ voiceItem.name }}
</n-button></n-space
>
</n-card>
</div>
</template>
<script></script>

0 comments on commit 9908283

Please sign in to comment.