2021-08-10 00:02:46 -07:00
|
|
|
export default {
|
|
|
|
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
windowWidth: window.innerWidth,
|
2021-09-23 01:31:45 -07:00
|
|
|
};
|
2021-08-10 00:02:46 -07:00
|
|
|
},
|
|
|
|
|
|
|
|
created() {
|
|
|
|
window.addEventListener("resize", this.onResize);
|
2021-09-23 01:31:45 -07:00
|
|
|
this.updateBody();
|
2021-08-10 00:02:46 -07:00
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
2022-06-02 07:15:21 -07:00
|
|
|
/** Handle screen resize */
|
2021-08-10 00:02:46 -07:00
|
|
|
onResize() {
|
|
|
|
this.windowWidth = window.innerWidth;
|
2021-09-23 01:31:45 -07:00
|
|
|
this.updateBody();
|
2021-08-10 00:02:46 -07:00
|
|
|
},
|
2021-09-23 01:31:45 -07:00
|
|
|
|
2022-06-02 08:40:56 -07:00
|
|
|
/** Add css-class "mobile" to body if needed */
|
2021-09-23 01:31:45 -07:00
|
|
|
updateBody() {
|
|
|
|
if (this.isMobile) {
|
|
|
|
document.body.classList.add("mobile");
|
|
|
|
} else {
|
|
|
|
document.body.classList.remove("mobile");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-08-10 00:02:46 -07:00
|
|
|
},
|
|
|
|
|
|
|
|
computed: {
|
|
|
|
isMobile() {
|
|
|
|
return this.windowWidth <= 767.98;
|
|
|
|
},
|
2021-09-23 01:31:45 -07:00
|
|
|
},
|
2021-08-10 00:02:46 -07:00
|
|
|
|
2021-09-23 01:31:45 -07:00
|
|
|
};
|