visgraph: init window.eventHub as external emitter called in Vue. This implementation works with vue2, but is deprecated in vue3 !!

see https://vue3-fr.netlify.app/guide/migration/events-api.html#_2-x-syntax
This commit is contained in:
2021-11-01 10:45:37 +01:00
parent c4ba78d076
commit a0940a0c85
3 changed files with 17 additions and 0 deletions

View File

@@ -79,6 +79,12 @@ export default {
}
},
created() {
eventHub.$on('add-switch', this.addSwitch)
},
unmounted() {
eventHub.$off('add-switch', this.addSwitch)
},
mounted() {
console.log('=== mounted: init graph')
this.initGraph()
@@ -118,6 +124,9 @@ export default {
console.log('** click on node **')
window.network.on('click', callback)
},
addSwitch(edgeData) {
console.log('==> addSwitch <=======================', edgeData)
},
}
/*
TODO / TO CHECK / TO UNDERSTAND