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