2022-12-22 09:01:58 +09:00
|
|
|
<template>
|
2023-01-06 13:40:17 +09:00
|
|
|
<div class="_gaps_m">
|
2022-12-22 09:01:58 +09:00
|
|
|
<FormSelect v-model="type">
|
|
|
|
<template #label>{{ i18n.ts.sound }}</template>
|
|
|
|
<option v-for="x in soundsTypes" :key="x" :value="x">{{ x == null ? i18n.ts.none : x }}</option>
|
|
|
|
</FormSelect>
|
2023-01-05 21:04:56 +09:00
|
|
|
<FormRange v-model="volume" :min="0" :max="1" :step="0.05" :text-converter="(v) => `${Math.floor(v * 100)}%`">
|
2022-12-22 09:01:58 +09:00
|
|
|
<template #label>{{ i18n.ts.volume }}</template>
|
|
|
|
</FormRange>
|
|
|
|
|
2023-01-06 09:41:14 +09:00
|
|
|
<div class="_buttons">
|
|
|
|
<MkButton inline @click="listen"><i class="ti ti-player-play"></i> {{ i18n.ts.listen }}</MkButton>
|
|
|
|
<MkButton inline primary @click="save"><i class="ti ti-check"></i> {{ i18n.ts.save }}</MkButton>
|
2022-12-22 09:01:58 +09:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts" setup>
|
|
|
|
import { } from 'vue';
|
|
|
|
import FormSelect from '@/components/form/select.vue';
|
2023-01-06 09:41:14 +09:00
|
|
|
import MkButton from '@/components/MkButton.vue';
|
2022-12-22 09:01:58 +09:00
|
|
|
import FormRange from '@/components/form/range.vue';
|
|
|
|
import { i18n } from '@/i18n';
|
|
|
|
import { playFile, soundsTypes } from '@/scripts/sound';
|
|
|
|
|
|
|
|
const props = defineProps<{
|
|
|
|
type: string;
|
|
|
|
volume: number;
|
|
|
|
}>();
|
|
|
|
|
|
|
|
const emit = defineEmits<{
|
|
|
|
(ev: 'update', result: { type: string; volume: number; }): void;
|
|
|
|
}>();
|
|
|
|
|
|
|
|
let type = $ref(props.type);
|
|
|
|
let volume = $ref(props.volume);
|
|
|
|
|
|
|
|
function listen() {
|
|
|
|
playFile(type, volume);
|
|
|
|
}
|
|
|
|
|
|
|
|
function save() {
|
|
|
|
emit('update', { type, volume });
|
|
|
|
}
|
|
|
|
</script>
|