Commit 3875c6a1 authored by Brandon Labuschagne's avatar Brandon Labuschagne

Ensure we destory click events

parent 5d696a75
...@@ -12,17 +12,22 @@ export default { ...@@ -12,17 +12,22 @@ export default {
return { return {
name: '', name: '',
path: '', path: '',
buttons: [],
}; };
}, },
mounted() { mounted() {
document.querySelectorAll('.js-application-delete-button').forEach((button) => { this.buttons = document.querySelectorAll('.js-application-delete-button');
button.addEventListener('click', (e) => {
e.preventDefault(); this.buttons.forEach((button) => button.addEventListener('click', this.buttonEvent));
this.show(button.dataset); },
}); destroy() {
}); this.buttons.forEach((button) => button.removeEventListener('click', this.buttonEvent));
}, },
methods: { methods: {
buttonEvent(e) {
e.preventDefault();
this.show(e.target.dataset);
},
show(dataset) { show(dataset) {
const { name, path } = dataset; const { name, path } = dataset;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment