You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
uptime-kuma/src/mixins/mobile.js

37 lines
678 B

export default {
data() {
return {
windowWidth: window.innerWidth,
};
},
created() {
window.addEventListener("resize", this.onResize);
this.updateBody();
},
methods: {
onResize() {
this.windowWidth = window.innerWidth;
this.updateBody();
},
updateBody() {
if (this.isMobile) {
document.body.classList.add("mobile");
} else {
document.body.classList.remove("mobile");
}
}
},
computed: {
isMobile() {
return this.windowWidth <= 767.98;
},
},
};