1
0
mirror of https://gitlab.com/bramw/baserow.git synced 2024-11-25 00:46:46 +00:00
bramw_baserow/web-frontend/modules/core/mixins/context.js
2023-02-23 08:43:10 +00:00

32 lines
777 B
JavaScript

/**
* This mixin is for components that have the Context component as root element.
* It will make it easier to call the root context specific functions.
*/
export default {
methods: {
getRootContext() {
if (
this.$children.length > 0 &&
this.$children[0].$options.name === 'Context'
) {
return this.$children[0]
}
},
toggle(...args) {
this.getRootContext().toggle(...args)
},
toggleNextToMouse(...args) {
this.getRootContext().toggleNextToMouse(...args)
},
show(...args) {
this.getRootContext().show(...args)
},
showNextToMouse(...args) {
this.getRootContext().showNextToMouse(...args)
},
hide(...args) {
this.getRootContext().hide(...args)
},
},
}