Skip to content

Commit 8439a60

Browse files
wenyuanwhonghuangdc
authored andcommitted
optimize(projects): improve theme drawer responsive width for mobile devices
1 parent f238fcb commit 8439a60

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/layouts/modules/theme-drawer/index.vue

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script setup lang="ts">
2-
import { ref } from 'vue';
2+
import { computed, ref } from 'vue';
33
import { useAppStore } from '@/store/modules/app';
44
import { $t } from '@/locales';
55
import AppearanceSettings from './modules/appearance/index.vue';
@@ -13,10 +13,19 @@ defineOptions({
1313
1414
const appStore = useAppStore();
1515
const activeTab = ref('appearance');
16+
17+
const drawerWidth = computed(() => {
18+
// On mobile devices, use 90% of viewport width with a maximum of 400px
19+
if (appStore.isMobile) {
20+
return 'min(90vw, 400px)';
21+
}
22+
23+
return 460;
24+
});
1625
</script>
1726

1827
<template>
19-
<NDrawer v-model:show="appStore.themeDrawerVisible" display-directive="show" :width="460">
28+
<NDrawer v-model:show="appStore.themeDrawerVisible" display-directive="show" :width="drawerWidth">
2029
<NDrawerContent :title="$t('theme.themeDrawerTitle')" :native-scrollbar="false" closable>
2130
<NTabs v-model:value="activeTab" type="segment" size="medium" class="mb-16px">
2231
<NTab name="appearance" :tab="$t('theme.tabs.appearance')"></NTab>

0 commit comments

Comments
 (0)