2
0
mirror of https://github.com/tenrok/vue-ganttastic.git synced 2026-06-18 20:00:34 +03:00

fix: resize event unbinding

This commit is contained in:
2021-10-06 23:17:09 +03:00
parent a5e20090d3
commit f0b4babea3
2 changed files with 15 additions and 9 deletions
+4 -2
View File
@@ -28,12 +28,14 @@
"devDependencies": {
"bili": "^4.10.0",
"rollup-plugin-vue": "^5.1.9",
"vue-template-compiler": "^2.6.10"
"vue-template-compiler": "^2.6.14"
},
"peerDependencies": {
"moment": "^2.26.0"
},
"dependencies": {},
"dependencies": {
"vue": "^2.6.14"
},
"bugs": {
"url": "https://github.com/yicone/vue-ganttastic/issues"
},
+11 -7
View File
@@ -95,13 +95,16 @@ export default {
window.addEventListener('resize', this.onWindowResize)
},
destroyed() {
window.removeEventListener('resize', this.onWindowResize)
},
methods: {
onDragover(e) {
e.preventDefault() // enables dropping content on row
if (this.highlightOnHover) {
this.$refs[
'g-gantt-row'
].style.backgroundColor = this.getThemeColors().hoverHighlight
this.$refs['g-gantt-row'].style.backgroundColor =
this.getThemeColors().hoverHighlight
}
},
@@ -153,9 +156,8 @@ export default {
onMouseover() {
if (this.highlightOnHover) {
this.$refs[
'g-gantt-row'
].style.backgroundColor = this.getThemeColors().hoverHighlight
this.$refs['g-gantt-row'].style.backgroundColor =
this.getThemeColors().hoverHighlight
}
},
@@ -165,7 +167,9 @@ export default {
onWindowResize() {
// re-initialize the barContainer DOMRect variable, which will trigger re-rendering in the gantt bars
this.barContainer = this.$refs.barContainer.getBoundingClientRect()
if (this.$refs.barContainer) {
this.barContainer = this.$refs.barContainer.getBoundingClientRect()
}
},
},