I have a table component in my application that I would like the auto adjust its height based on a calculation (window height - (menuHeight + footerHeight). The menuHeight is local data in my apollo cache, requiring a query to receive inside my table component. This calculation needs to be ran in 2 cases:
I need help determining the best approach to satisfy both. A computed property satisfies the first but does not update as the window height change(img 1), and using methods and event listeners (img 2) to update works for the second case but I dont know how to run this once the apollo data is received or changes, as i cant just run the method in the mounted or beforeUpdate lifecycles.
You can use watch
(see the Vue docs here):
watch: {
ui(newValue, oldValue) {
resizeTableHeight() // or whatever...
}
}