mirror of https://github.com/nocodb/nocodb
6 changed files with 80 additions and 23 deletions
@ -0,0 +1,29 @@
|
||||
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, |
||||
} |
||||
}) |
Loading…
Reference in new issue