The class based components in our project utilize a getter to retrieve the window innerWidth. However, I've noticed that the value is only set once and doesn't update if the window width changes.
get viewPortWidth() {
if (process.client) {
if (window.innerWidth !== undefined && window.innerHeight !== undefined) {
return window.innerWidth;
} else {
return document.documentElement.clientWidth;
}
}
return false;
}
When I output the value in the HTML using {{viewPortWidth}}
, it remains the same and doesn't update, even in vue devtools. Shouldn't getters function like computed properties? How can I ensure that the value updates seamlessly?