2021-08-10 03:02:46 -04:00
|
|
|
export default {
|
|
|
|
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
windowWidth: window.innerWidth,
|
2021-09-23 04:31:45 -04:00
|
|
|
};
|
2021-08-10 03:02:46 -04:00
|
|
|
},
|
|
|
|
|
|
|
|
created() {
|
|
|
|
window.addEventListener("resize", this.onResize);
|
2021-09-23 04:31:45 -04:00
|
|
|
this.updateBody();
|
2021-08-10 03:02:46 -04:00
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
|
|
|
onResize() {
|
|
|
|
this.windowWidth = window.innerWidth;
|
2021-09-23 04:31:45 -04:00
|
|
|
this.updateBody();
|
2021-08-10 03:02:46 -04:00
|
|
|
},
|
2021-09-23 04:31:45 -04:00
|
|
|
|
|
|
|
updateBody() {
|
|
|
|
if (this.isMobile) {
|
|
|
|
document.body.classList.add("mobile");
|
|
|
|
} else {
|
|
|
|
document.body.classList.remove("mobile");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-08-10 03:02:46 -04:00
|
|
|
},
|
|
|
|
|
|
|
|
computed: {
|
|
|
|
isMobile() {
|
|
|
|
return this.windowWidth <= 767.98;
|
|
|
|
},
|
2021-09-23 04:31:45 -04:00
|
|
|
},
|
2021-08-10 03:02:46 -04:00
|
|
|
|
2021-09-23 04:31:45 -04:00
|
|
|
};
|