fix: removed useScreenSize composable
This commit is contained in:
parent
c41a269962
commit
fe8a93f43e
@ -10,11 +10,9 @@
|
||||
<script setup>
|
||||
import { Dialogs } from '@/utils/dialogs'
|
||||
import { sessionStore as session } from '@/stores/session'
|
||||
import { useScreenSize } from '@/composables'
|
||||
import { Toasts } from 'frappe-ui'
|
||||
import { computed, defineAsyncComponent } from 'vue'
|
||||
|
||||
const screenSize = useScreenSize()
|
||||
const MobileLayout = defineAsyncComponent(() =>
|
||||
import('./components/Layouts/MobileLayout.vue')
|
||||
)
|
||||
@ -22,7 +20,7 @@ const DesktopLayout = defineAsyncComponent(() =>
|
||||
import('./components/Layouts/DesktopLayout.vue')
|
||||
)
|
||||
const Layout = computed(() => {
|
||||
if (screenSize.width < 640) {
|
||||
if (window.innerWidth < 640) {
|
||||
return MobileLayout
|
||||
} else {
|
||||
return DesktopLayout
|
||||
|
||||
@ -1,23 +0,0 @@
|
||||
import { onMounted, onUnmounted, reactive } from 'vue'
|
||||
|
||||
export function useScreenSize() {
|
||||
const size = reactive({
|
||||
width: window.innerWidth,
|
||||
height: window.innerHeight,
|
||||
})
|
||||
|
||||
const onResize = () => {
|
||||
size.width = window.innerWidth
|
||||
size.height = window.innerHeight
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
window.addEventListener('resize', onResize)
|
||||
})
|
||||
|
||||
onUnmounted(() => {
|
||||
window.removeEventListener('resize', onResize)
|
||||
})
|
||||
|
||||
return size
|
||||
}
|
||||
@ -1,5 +1,4 @@
|
||||
import { createResource } from 'frappe-ui'
|
||||
import { useScreenSize } from '@/composables'
|
||||
import { computed, ref } from 'vue'
|
||||
|
||||
export const whatsappEnabled = ref(false)
|
||||
@ -23,5 +22,4 @@ createResource({
|
||||
|
||||
export const mobileSidebarOpened = ref(false)
|
||||
|
||||
const screenSize = useScreenSize()
|
||||
export const isMobileView = computed(() => screenSize.width < 768)
|
||||
export const isMobileView = computed(() => window.innerWidth < 768)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user