Skip to content

Commit

Permalink
feat(projects): support mobile layout
Browse files Browse the repository at this point in the history
  • Loading branch information
honghuangdc committed Nov 7, 2023
1 parent 4649dec commit cfcf835
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 3 deletions.
22 changes: 21 additions & 1 deletion src/layouts/base-layout/index.vue
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<script setup lang="ts">
import { watch } from 'vue';
import { breakpointsTailwind, useBreakpoints } from '@vueuse/core';
import { AdminLayout } from '@sa/materials';
import { useAppStore } from '@/store/modules/app';
import GlobalHeader from '../modules/global-header/index.vue';
Expand All @@ -13,10 +15,28 @@ defineOptions({
});
const app = useAppStore();
const breakpoints = useBreakpoints(breakpointsTailwind);
const isMobile = breakpoints.smaller('sm');
watch(
isMobile,
newValue => {
if (newValue) {
app.toggleSiderCollapse();
}
},
{ immediate: true }
);
</script>

<template>
<AdminLayout :sider-collapse="app.siderCollapse" :full-content="app.fullContent">
<AdminLayout
:is-mobile="isMobile"
:sider-collapse="app.siderCollapse"
:full-content="app.fullContent"
@click-mobile-sider-mask="app.toggleSiderCollapse"
>
<template #header>
<GlobalHeader />
</template>
Expand Down
2 changes: 1 addition & 1 deletion src/layouts/modules/global-tab/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ init();
<template>
<DarkModeContainer class="flex-y-center wh-full px-16px shadow-tab">
<div ref="bsWrapper" class="flex-1-hidden h-full">
<BetterScroll ref="bsScroll" :options="{ scrollX: true, scrollY: false }">
<BetterScroll ref="bsScroll" :options="{ scrollX: true, scrollY: false, click: true }">
<div ref="tabRef" class="flex h-full pr-18px" :class="[isChromeMode ? 'items-end' : 'items-center gap-12px']">
<ContextMenu
v-for="item in tab.tabs"
Expand Down
6 changes: 5 additions & 1 deletion src/layouts/modules/theme-drawer/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@ const app = useAppStore();
:title="$t('themeDrawer.title')"
:closable="false"
@close="app.closeThemeDrawer"
></ADrawer>
>
<template #extra>
<AButton @click="app.closeThemeDrawer">{{ $t('common.cancel') }}</AButton>
</template>
</ADrawer>
</template>

<style scoped></style>

0 comments on commit cfcf835

Please sign in to comment.