forked from dbroqua/MusicTopus
Added Escape keydown gesture
This commit is contained in:
parent
061e72c459
commit
d692090022
3 changed files with 48 additions and 4 deletions
|
@ -34,6 +34,11 @@ Vue.createApp({
|
|||
},
|
||||
created() {
|
||||
this.fetch();
|
||||
|
||||
window.addEventListener("keydown", this.keyDown);
|
||||
},
|
||||
destroyed() {
|
||||
window.removeEventListener("keydown", this.keyDown);
|
||||
},
|
||||
methods: {
|
||||
formatParams(param) {
|
||||
|
@ -241,5 +246,16 @@ Vue.createApp({
|
|||
|
||||
return render;
|
||||
},
|
||||
keyDown(event) {
|
||||
const keycode = event.code;
|
||||
if (this.showModalDelete && keycode === "Escape") {
|
||||
event.preventDefault();
|
||||
this.showModalDelete = false;
|
||||
}
|
||||
if (this.showModalShare && keycode === "Escape") {
|
||||
event.preventDefault();
|
||||
this.showModalShare = false;
|
||||
}
|
||||
},
|
||||
},
|
||||
}).mount("#collection");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue