fix: remove listener on form unmount

This commit is contained in:
2018-09-06 18:16:34 -07:00
parent 50a3b1db92
commit 4591a47dba

View File

@@ -294,7 +294,10 @@
}; };
}, },
created() { created() {
emitter.on('error', msg => this.error = msg); emitter.on('error', this.setError);
},
beforeDestroy() {
emitter.off('error', this.setError);
}, },
methods: { methods: {
handleSubmit() { handleSubmit() {
@@ -311,7 +314,10 @@
}, },
resetForm() { resetForm() {
this.$el.reset(); this.$el.reset();
} },
setError(msg) {
this.error = msg
},
}, },
}); });