Feat: Add optional width parameter to isMobile() method

This commit is contained in:
NihadBadalov 2024-02-14 10:31:31 +01:00
parent cf2d603e27
commit 45c03c2b40

View File

@ -36,8 +36,14 @@ export default {
},
computed: {
isMobile() {
return this.windowWidth <= 767.98;
/**
* @param {number? | undefined} width Width of the device
* @returns {boolean} Whether the device is mobile
*/
isMobile(width) {
return (width && typeof width === "number"
? width ?? this.windowWidth
: this.windowWidth) <= 767.98;
},
},