mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-12 23:35:58 +00:00
23 lines
519 B
JavaScript
23 lines
519 B
JavaScript
export default (mobileWidth = null) => {
|
|
return {
|
|
data() {
|
|
return {
|
|
windowWidth: null,
|
|
maxMobileWidth: mobileWidth || 810, // greater counts as desktop
|
|
}
|
|
},
|
|
computed: {
|
|
isMobile() {
|
|
if (!this.windowWidth) return false
|
|
return this.windowWidth <= this.maxMobileWidth
|
|
},
|
|
},
|
|
mounted() {
|
|
this.windowWidth = window.innerWidth
|
|
window.addEventListener('resize', () => {
|
|
this.windowWidth = window.innerWidth
|
|
})
|
|
},
|
|
}
|
|
}
|