2
0
mirror of https://github.com/tenrok/vue-ganttastic.git synced 2026-06-24 04:40: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": { "devDependencies": {
"bili": "^4.10.0", "bili": "^4.10.0",
"rollup-plugin-vue": "^5.1.9", "rollup-plugin-vue": "^5.1.9",
"vue-template-compiler": "^2.6.10" "vue-template-compiler": "^2.6.14"
}, },
"peerDependencies": { "peerDependencies": {
"moment": "^2.26.0" "moment": "^2.26.0"
}, },
"dependencies": {}, "dependencies": {
"vue": "^2.6.14"
},
"bugs": { "bugs": {
"url": "https://github.com/yicone/vue-ganttastic/issues" "url": "https://github.com/yicone/vue-ganttastic/issues"
}, },
+11 -7
View File
@@ -95,13 +95,16 @@ export default {
window.addEventListener('resize', this.onWindowResize) window.addEventListener('resize', this.onWindowResize)
}, },
destroyed() {
window.removeEventListener('resize', this.onWindowResize)
},
methods: { methods: {
onDragover(e) { onDragover(e) {
e.preventDefault() // enables dropping content on row e.preventDefault() // enables dropping content on row
if (this.highlightOnHover) { if (this.highlightOnHover) {
this.$refs[ this.$refs['g-gantt-row'].style.backgroundColor =
'g-gantt-row' this.getThemeColors().hoverHighlight
].style.backgroundColor = this.getThemeColors().hoverHighlight
} }
}, },
@@ -153,9 +156,8 @@ export default {
onMouseover() { onMouseover() {
if (this.highlightOnHover) { if (this.highlightOnHover) {
this.$refs[ this.$refs['g-gantt-row'].style.backgroundColor =
'g-gantt-row' this.getThemeColors().hoverHighlight
].style.backgroundColor = this.getThemeColors().hoverHighlight
} }
}, },
@@ -165,7 +167,9 @@ export default {
onWindowResize() { onWindowResize() {
// re-initialize the barContainer DOMRect variable, which will trigger re-rendering in the gantt bars // 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()
}
}, },
}, },