fix: Turn off FOCUS_CUSTOM_ATTRIBUTE event to avoid memory leak (#6772)

This commit is contained in:
Pavel Kuzmin
2023-03-29 06:29:15 +05:00
committed by GitHub
parent 6002394fcf
commit 2b7ff48bcd

View File

@@ -218,13 +218,17 @@ export default {
},
mounted() {
this.editedValue = this.formattedValue;
bus.$on(BUS_EVENTS.FOCUS_CUSTOM_ATTRIBUTE, focusAttributeKey => {
bus.$on(BUS_EVENTS.FOCUS_CUSTOM_ATTRIBUTE, this.onFocusAttribute);
},
destroyed() {
bus.$off(BUS_EVENTS.FOCUS_CUSTOM_ATTRIBUTE, this.onFocusAttribute);
},
methods: {
onFocusAttribute(focusAttributeKey) {
if (this.attributeKey === focusAttributeKey) {
this.onEdit();
}
});
},
methods: {
focusInput() {
if (this.$refs.inputfield) {
this.$refs.inputfield.focus();