4
0
mirror of https://github.com/AzuraCast/AzuraCast.git synced 2024-06-13 12:46:41 +00:00
AzuraCast/frontend/vue/components/Public/WebDJ/VolumeSlider.vue
2022-12-20 04:19:23 -06:00

47 lines
1.1 KiB
Vue

<template>
<div class="d-flex flex-row align-items-center">
<div class="flex-shrink-0">
<icon icon="volume_mute"></icon>
</div>
<div class="flex-fill px-2">
<input type="range" min="0" max="100" class="custom-range slider"
v-model.number="volume" @click.right.prevent="reset" style="height: 10px; width: 100px;">
</div>
<div class="flex-shrink-0">
<icon icon="volume_up"></icon>
</div>
</div>
</template>
<script setup>
import Icon from "~/components/Common/Icon";
import {onMounted, ref} from "vue";
import {useVModel} from "@vueuse/core";
const props = defineProps({
modelValue: String
});
const emit = defineEmits(['update:modelValue']);
const initial = ref(75);
onMounted(() => {
initial.value = props.modelValue;
});
const volume = useVModel(props, 'modelValue', emit);
const reset = () => {
volume.value = initial.value;
}
</script>
<script>
export default {
model: {
prop: 'modelValue',
event: 'update:modelValue'
}
}
</script>