feat: auto focus CreatePlaylistModal input field

This commit is contained in:
Andy Russo 2024-03-16 21:02:19 +05:00 committed by Bnyro
parent 6311eb73de
commit 256cab83a0

View File

@ -2,7 +2,7 @@
<ModalComponent @close="$emit('close')"> <ModalComponent @close="$emit('close')">
<div class="flex flex-col"> <div class="flex flex-col">
<h2 v-t="'actions.create_playlist'" /> <h2 v-t="'actions.create_playlist'" />
<input v-model="playlistName" type="text" class="input mt-2" /> <input ref="input" v-model="playlistName" type="text" class="input mt-2" />
<div class="ml-auto mt-3 w-min flex"> <div class="ml-auto mt-3 w-min flex">
<button v-t="'actions.cancel'" class="btn" @click="$emit('close')" /> <button v-t="'actions.cancel'" class="btn" @click="$emit('close')" />
<button v-t="'actions.okay'" class="btn ml-2" @click="onCreatePlaylist" /> <button v-t="'actions.okay'" class="btn ml-2" @click="onCreatePlaylist" />
@ -25,6 +25,7 @@ export default {
}; };
}, },
mounted() { mounted() {
this.$refs.input.focus();
window.addEventListener("keydown", this.handleKeyDown); window.addEventListener("keydown", this.handleKeyDown);
}, },
unmounted() { unmounted() {