Skip to content

Commit 41afa08

Browse files
committed
Added graph removal
1 parent 5d1a12c commit 41afa08

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/Vue2LeafletHeightGraph.vue

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,11 @@
4747
this.updateGraph()
4848
})
4949
},
50+
beforeDestroy() {
51+
if(this.hg) {
52+
this.hg.remove()
53+
}
54+
},
5055
methods: {
5156
updateGraph() {
5257
if(this.hg) {
@@ -61,7 +66,11 @@
6166
},
6267
watch: {
6368
data: function () {
64-
this.updateGraph();
69+
if(!this.data && this.hg) {
70+
this.hg.remove()
71+
} else {
72+
this.updateGraph();
73+
}
6574
},
6675
}
6776
}

0 commit comments

Comments
 (0)