mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-02-01 08:13:10 -08:00
213aca4fc3
Signed-off-by: Matthew Nickson <[email protected]>
39 lines
769 B
JavaScript
39 lines
769 B
JavaScript
export default {
|
|
|
|
data() {
|
|
return {
|
|
windowWidth: window.innerWidth,
|
|
};
|
|
},
|
|
|
|
created() {
|
|
window.addEventListener("resize", this.onResize);
|
|
this.updateBody();
|
|
},
|
|
|
|
methods: {
|
|
/** Called when the screen changes size */
|
|
onResize() {
|
|
this.windowWidth = window.innerWidth;
|
|
this.updateBody();
|
|
},
|
|
|
|
/** Update the document body */
|
|
updateBody() {
|
|
if (this.isMobile) {
|
|
document.body.classList.add("mobile");
|
|
} else {
|
|
document.body.classList.remove("mobile");
|
|
}
|
|
}
|
|
|
|
},
|
|
|
|
computed: {
|
|
isMobile() {
|
|
return this.windowWidth <= 767.98;
|
|
},
|
|
},
|
|
|
|
};
|