Skip to content
This repository was archived by the owner on Oct 24, 2019. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion example/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ export default {
score: '5'
}
],
rowHeaders: ['checkbox'],
myTheme: {
name: 'myTheme',
value: {
Expand All @@ -143,6 +142,9 @@ export default {
}
}
}
},
options: {
rowHeaders: ['checkbox']
}
};
},
Expand Down
35 changes: 7 additions & 28 deletions src/Grid.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,6 @@
<script>
import Grid from 'tui-grid';

const gridEvents = [
'beforeRequest',
'check',
'click',
'collapse',
'dblclick',
'errorResponse',
'expand',
'failResponse',
'focusChange',
'mousedown',
'mouseout',
'mouseover',
'response',
'selection',
'successResponse',
'uncheck'
];

const presetTheme = ['default', 'striped', 'clean'];

const presetLanguage = ['en', 'ko'];
Expand Down Expand Up @@ -71,11 +52,6 @@ export default {
}
}
},
data() {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

memory leak 수정사항 반영 부분입니다.

return {
gridInstance: null
};
},
mounted() {
const options = Object.assign({}, this.options, {
el: this.$refs.tuiGrid,
Expand All @@ -87,15 +63,18 @@ export default {
this.applyTheme();
this.setLanguage();
},
destroyed() {
gridEvents.forEach((eventName) => this.gridInstance.off(eventName));
beforeDestroy() {
for (const eventName of Object.keys(this.$listeners)) {
this.gridInstance.off(eventName);
}

this.gridInstance.destroy();
},
methods: {
addEventListeners() {
gridEvents.forEach((eventName) => {
for (const eventName of Object.keys(this.$listeners)) {
this.gridInstance.on(eventName, (...args) => this.$emit(eventName, ...args));
});
}
},
applyTheme() {
if (this.theme) {
Expand Down