mirror of https://github.com/nocodb/nocodb
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
642 B
30 lines
642 B
12 months ago
|
import { defineStore } from 'pinia'
|
||
|
|
||
|
export const useConfigStore = defineStore('configStore', () => {
|
||
|
const { isMobileMode: globalIsMobile } = useGlobal()
|
||
|
const isMobileMode = ref(window.innerWidth < 820)
|
||
|
|
||
|
const isViewPortMobile = () => window.innerWidth < 820
|
||
|
|
||
|
const onViewPortResize = () => {
|
||
|
isMobileMode.value = isViewPortMobile()
|
||
|
}
|
||
|
|
||
|
window.addEventListener('DOMContentLoaded', onViewPortResize)
|
||
|
window.addEventListener('resize', onViewPortResize)
|
||
|
|
||
|
watch(
|
||
|
isMobileMode,
|
||
|
() => {
|
||
|
globalIsMobile.value = isMobileMode.value
|
||
|
},
|
||
|
{
|
||
|
immediate: true,
|
||
|
},
|
||
|
)
|
||
|
|
||
|
return {
|
||
|
isMobileMode,
|
||
|
}
|
||
|
})
|