diff --git a/package.json b/package.json index 4941ee9..6522a98 100644 --- a/package.json +++ b/package.json @@ -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" }, diff --git a/src/GGanttRow.vue b/src/GGanttRow.vue index 64a5d7b..fa3d487 100644 --- a/src/GGanttRow.vue +++ b/src/GGanttRow.vue @@ -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() + } }, },