|
1 | 1 | <template> |
2 | 2 | <div class="layout"> |
3 | | - <tiny-container :aside-width="250" :pattern="myPattern"> |
4 | | - <template #header> |
5 | | - <tiny-layout> |
6 | | - <div class="layout-navbar"> |
7 | | - <NavBar /> |
8 | | - </div> |
9 | | - </tiny-layout> |
10 | | - </template> |
11 | | - <template #aside> |
12 | | - <tiny-layout class="layout-sider"> |
13 | | - <div class="menu-wrapper"> |
14 | | - <Suspense> |
15 | | - <Menu v-if="reloadKey !== 'menu'" /> |
16 | | - </Suspense> |
17 | | - </div> |
18 | | - </tiny-layout> |
19 | | - </template> |
20 | | - <tiny-layout class="layout-content"> |
21 | | - <Tabs |
22 | | - :key="tabsRefreshKey" |
23 | | - v-model="currentTabName" |
24 | | - with-close |
25 | | - @click="onClick" |
26 | | - @close="onClose" |
27 | | - > |
28 | | - <tab-item |
29 | | - v-for="(history, idx) of tabsHistory" |
30 | | - :key="idx" |
31 | | - :title="t(history.name)" |
32 | | - :name="history.link" |
33 | | - ></tab-item> |
34 | | - </Tabs> |
35 | | - <PageLayout /> |
36 | | - </tiny-layout> |
37 | | - <template #footer> |
38 | | - <tiny-layout> |
39 | | - <div class="layout-footer"> |
40 | | - <Footer /> |
41 | | - </div> |
42 | | - </tiny-layout> |
43 | | - </template> |
44 | | - </tiny-container> |
| 3 | + <div> |
| 4 | + <div class="shadow-[0_4px_6px_#0003] relative z-[999]"> |
| 5 | + <NavBar v-if="layoutMode[myPattern].navbar"/> |
| 6 | + </div> |
| 7 | + <div class="flex"> |
| 8 | + <Suspense> |
| 9 | + <Menu v-if="reloadKey !== 'menu' && layoutMode[myPattern].menu" class="shadow-[0_4px_12px_#0000001a] z-[100]" /> |
| 10 | + </Suspense> |
| 11 | + <div class="text-[#ccc] bg-[#f5f6f7] pl-[10px] pr-[10px] flex-1 h-[calc(100vh-60px)]" :style="{ width: isMenuCollapsed ? '100%' : 'calc(100% - 220px)' }"> |
| 12 | + <Tabs |
| 13 | + :key="tabsRefreshKey" |
| 14 | + v-model="currentTabName" |
| 15 | + with-close |
| 16 | + @click="onClick" |
| 17 | + @close="onClose" |
| 18 | + > |
| 19 | + <tab-item |
| 20 | + v-for="(history, idx) of tabsHistory" |
| 21 | + :key="idx" |
| 22 | + :title="t(history.name)" |
| 23 | + :name="history.link" |
| 24 | + ></tab-item> |
| 25 | + </Tabs> |
| 26 | + <PageLayout class="!h-[calc(100%-120px)]" /> |
| 27 | + <Footer v-if="layoutMode[myPattern].footer" class="h-[60px]" /> |
| 28 | + </div> |
| 29 | + </div> |
| 30 | + </div> |
45 | 31 | <div class="theme-box" @click="themeVisible"> |
46 | 32 | <img src="@/assets/images/theme.png" /> |
47 | 33 | </div> |
|
72 | 58 | </template> |
73 | 59 |
|
74 | 60 | <script lang="ts" setup> |
75 | | - import { ref, watch, onMounted, computed, nextTick, provide } from 'vue'; |
| 61 | + import { ref, watch, computed, nextTick, provide } from 'vue'; |
76 | 62 | import { useI18n } from 'vue-i18n'; |
77 | 63 | import { |
78 | | - Container as TinyContainer, |
79 | | - Layout as TinyLayout, |
80 | 64 | Modal as tinyModal, |
81 | 65 | Tabs, |
82 | 66 | TabItem, |
|
96 | 80 | // 动态切换 |
97 | 81 | const router = useRouter(); |
98 | 82 | const appStore = useAppStore(); |
99 | | - const changefooter = ref('#fff'); |
| 83 | + const footerColor = ref('#fff'); |
100 | 84 |
|
101 | 85 | const { t } = useI18n(); |
102 | 86 | const tabStore = useTabStore(); |
103 | 87 |
|
104 | 88 | const tabsHistory = computed(() => tabStore.data); |
105 | 89 | const currentTabName = ref(); |
106 | 90 |
|
| 91 | + const { isMenuCollapsed } = appStore; |
| 92 | +
|
107 | 93 | const reloadKey = ref(''); |
108 | 94 | const reloadMenu = () => { |
109 | 95 | reloadKey.value = 'menu'; |
|
203 | 189 | // 是否显示切换框架结构 |
204 | 190 | const myPattern = ref('legend'); |
205 | 191 |
|
| 192 | + const layoutMode = { |
| 193 | + // 传奇布局 |
| 194 | + legend: { |
| 195 | + navbar: true, |
| 196 | + menu: true, |
| 197 | + footer: true, |
| 198 | + }, |
| 199 | + // 简约布局 |
| 200 | + simple: { |
| 201 | + navbar: false, |
| 202 | + menu: true, |
| 203 | + footer: false, |
| 204 | + }, |
| 205 | + // 时尚布局 |
| 206 | + fashion: { |
| 207 | + navbar: true, |
| 208 | + menu: true, |
| 209 | + footer: false, |
| 210 | + }, |
| 211 | + // 经典布局 |
| 212 | + classic: { |
| 213 | + navbar: true, |
| 214 | + menu: false, |
| 215 | + footer: true, |
| 216 | + }, |
| 217 | + // 默认布局 |
| 218 | + default: { |
| 219 | + navbar: true, |
| 220 | + menu: true, |
| 221 | + footer: false, |
| 222 | + }, |
| 223 | + } |
| 224 | +
|
206 | 225 | // 主题配置 |
207 | 226 | const disTheme = ref(false); |
208 | 227 | const theme = new TinyThemeTool(); |
|
227 | 246 |
|
228 | 247 | watch(appStore.$state, (newValue, oldValue) => { |
229 | 248 | if (newValue.theme === 'dark') { |
230 | | - changefooter.value = '#262323;'; |
| 249 | + footerColor.value = '#262323;'; |
231 | 250 | } else { |
232 | | - changefooter.value = '#fff;'; |
| 251 | + footerColor.value = '#fff;'; |
233 | 252 | } |
234 | 253 | }); |
235 | 254 | // 初始化默认主题 |
|
241 | 260 | height: 100%; |
242 | 261 | } |
243 | 262 |
|
244 | | - .layout-navbar { |
245 | | - position: fixed; |
246 | | - left: 0; |
247 | | - z-index: 999; |
248 | | - width: 100%; |
249 | | - height: 60px; |
250 | | - background-color: #fff; |
251 | | - box-shadow: 0 4px 6px 0 rgba(0, 0, 0, 0.2); |
252 | | - } |
253 | | -
|
254 | | - .menu-wrapper { |
255 | | - width: inherit; |
256 | | - height: 92vh; |
257 | | - margin-top: v-bind(top); |
258 | | - overflow-x: hidden; |
259 | | - overflow-y: auto; |
260 | | - } |
261 | | -
|
262 | 263 | .global-setting { |
263 | 264 | position: fixed; |
264 | 265 | top: 280px; |
|
268 | 269 | height: 30px; |
269 | 270 | } |
270 | 271 |
|
271 | | - .layout :deep(.tiny-container .tiny-container__aside) { |
272 | | - z-index: 100; |
273 | | - background: #fff; |
274 | | - border-left: 1px solid #ccc; |
275 | | - box-shadow: 0 4px 12px 0 rgba(0, 0, 0, 0.1); |
276 | | - } |
277 | | -
|
278 | | - .layout :deep(.tiny-container .tiny-container__main) { |
279 | | - background-color: #f5f6f7; |
280 | | - } |
281 | | -
|
282 | | - .layout :deep(.layout-content) { |
283 | | - height: 100%; |
284 | | - padding: 0 10px; |
285 | | - overflow: hidden; |
286 | | - } |
287 | | -
|
288 | | - .layout :deep(.tiny-container .tiny-container__footer) { |
289 | | - display: flex; |
290 | | - justify-content: center; |
291 | | - padding-top: 15px; |
292 | | - background-color: #f5f6f7; |
293 | | - } |
294 | | -
|
295 | 272 | // 组件无法固定非message的modal类型距离顶部距离 |
296 | 273 | :deep(.tiny-modal__box) { |
297 | 274 | top: 8px !important; |
|
319 | 296 | padding: 0 16px; |
320 | 297 | } |
321 | 298 |
|
| 299 | + :deep(.tiny-tree-menu .tiny-tree) { |
| 300 | + height: 100%; |
| 301 | + overflow: auto; |
| 302 | + } |
| 303 | +
|
322 | 304 | .theme-box { |
323 | 305 | position: fixed; |
324 | 306 | top: 88%; |
|
0 commit comments