diff --git a/frontend/app.vue b/frontend/app.vue index 75ca905..cb55b98 100644 --- a/frontend/app.vue +++ b/frontend/app.vue @@ -14,12 +14,23 @@ // So we detect desktop onMounted and update reactively. const isDesktop = ref(false) +const updateDprVar = () => { + const dpr = window.devicePixelRatio || 1 + document.documentElement.style.setProperty('--dpr', String(dpr)) +} + onMounted(() => { isDesktop.value = !!window?.wechatDesktop + updateDprVar() + window.addEventListener('resize', updateDprVar) +}) + +onBeforeUnmount(() => { + window.removeEventListener('resize', updateDprVar) }) const route = useRoute() -const isChatRoute = computed(() => route.path?.startsWith('/chat')) +const isChatRoute = computed(() => route.path?.startsWith('/chat') || route.path?.startsWith('/sns')) const rootClass = computed(() => { const base = 'bg-gradient-to-br from-green-50 via-emerald-50 to-green-100' @@ -34,6 +45,14 @@ const contentClass = computed(() =>