Popover now also removes its eventlistener on close
This commit is contained in:
@@ -12,16 +12,31 @@
|
|||||||
import Movie from './Movie.vue';
|
import Movie from './Movie.vue';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
props: ['id', 'type'],
|
props: {
|
||||||
|
id: {
|
||||||
|
type: Number,
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
type: {
|
||||||
|
type: String,
|
||||||
|
required: true
|
||||||
|
}
|
||||||
|
},
|
||||||
components: { Movie },
|
components: { Movie },
|
||||||
created(){
|
methods: {
|
||||||
let that = this
|
checkEventForEscapeKey(event) {
|
||||||
window.addEventListener('keyup', function(e){
|
if (event.keyCode == 27) {
|
||||||
if (e.keyCode == 27) {
|
this.$popup.close()
|
||||||
that.$popup.close()
|
|
||||||
}
|
}
|
||||||
})
|
}
|
||||||
|
},
|
||||||
|
created(){
|
||||||
|
window.addEventListener('keyup', this.checkEventForEscapeKey)
|
||||||
|
},
|
||||||
|
beforeDestroy() {
|
||||||
|
window.removeEventListener('keyup', this.checkEventForEscapeKey)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user