diff --git a/arco-design-pro-vite/src/components/global-setting/block.vue b/arco-design-pro-vite/src/components/global-setting/block.vue index 3359774..be43e8c 100644 --- a/arco-design-pro-vite/src/components/global-setting/block.vue +++ b/arco-design-pro-vite/src/components/global-setting/block.vue @@ -50,6 +50,11 @@ if (key === 'menuFromServer' && value) { await appStore.fetchServerMenuConfig(); } + if (key === 'topMenu') { + appStore.updateSettings({ + menuCollapse: false, + }); + } appStore.updateSettings({ [key]: value }); }; diff --git a/arco-design-pro-vite/src/components/global-setting/index.vue b/arco-design-pro-vite/src/components/global-setting/index.vue index 90df23c..7874fbe 100644 --- a/arco-design-pro-vite/src/components/global-setting/index.vue +++ b/arco-design-pro-vite/src/components/global-setting/index.vue @@ -43,6 +43,11 @@ key: 'menu', defaultVal: appStore.menu, }, + { + name: 'settings.topMenu', + key: 'topMenu', + defaultVal: appStore.topMenu, + }, { name: 'settings.footer', key: 'footer', defaultVal: appStore.footer }, { name: 'settings.tabBar', key: 'tabBar', defaultVal: appStore.tabBar }, { diff --git a/arco-design-pro-vite/src/components/menu/index.vue b/arco-design-pro-vite/src/components/menu/index.vue index 60261f7..0702897 100644 --- a/arco-design-pro-vite/src/components/menu/index.vue +++ b/arco-design-pro-vite/src/components/menu/index.vue @@ -26,6 +26,7 @@ }, }); + const topMenu = computed(() => appStore.topMenu); const openKeys = ref([]); const selectedKey = ref([]); @@ -126,6 +127,7 @@ return () => ( {renderSubMenu()} diff --git a/arco-design-pro-vite/src/components/navbar/index.vue b/arco-design-pro-vite/src/components/navbar/index.vue index 0b55e59..55afe6f 100644 --- a/arco-design-pro-vite/src/components/navbar/index.vue +++ b/arco-design-pro-vite/src/components/navbar/index.vue @@ -13,12 +13,15 @@ Arco Pro +
+ +
  • @@ -194,6 +197,7 @@ import { LOCALE_OPTIONS } from '@/locale'; import useLocale from '@/hooks/locale'; import useUser from '@/hooks/user'; + import Menu from '@/components/menu/index.vue'; import MessageBox from '../message-box/index.vue'; const appStore = useAppStore(); @@ -208,6 +212,7 @@ const theme = computed(() => { return appStore.theme; }); + const topMenu = computed(() => appStore.topMenu && appStore.menu); const isDark = useDark({ selector: 'body', attribute: 'arco-theme', @@ -269,6 +274,10 @@ padding-left: 20px; } + .center-side { + flex: 1; + } + .right-side { display: flex; padding-right: 20px; diff --git a/arco-design-pro-vite/src/config/settings.json b/arco-design-pro-vite/src/config/settings.json index aabd7f0..ef20b23 100644 --- a/arco-design-pro-vite/src/config/settings.json +++ b/arco-design-pro-vite/src/config/settings.json @@ -3,6 +3,7 @@ "colorWeak": false, "navbar": true, "menu": true, + "topMenu": false, "hideMenu": false, "menuCollapse": false, "footer": true, diff --git a/arco-design-pro-vite/src/layout/default-layout.vue b/arco-design-pro-vite/src/layout/default-layout.vue index 7f5888f..d82e058 100644 --- a/arco-design-pro-vite/src/layout/default-layout.vue +++ b/arco-design-pro-vite/src/layout/default-layout.vue @@ -64,7 +64,7 @@ useResponsive(true); const navbarHeight = `60px`; const navbar = computed(() => appStore.navbar); - const renderMenu = computed(() => appStore.menu); + const renderMenu = computed(() => appStore.menu && !appStore.topMenu); const hideMenu = computed(() => appStore.hideMenu); const footer = computed(() => appStore.footer); const menuWidth = computed(() => { diff --git a/arco-design-pro-vite/src/locale/en-US/settings.ts b/arco-design-pro-vite/src/locale/en-US/settings.ts index 89bb123..f929e50 100644 --- a/arco-design-pro-vite/src/locale/en-US/settings.ts +++ b/arco-design-pro-vite/src/locale/en-US/settings.ts @@ -12,6 +12,7 @@ export default { 'settings.navbar.screen.toExit': 'Click to exit the full screen mode', 'settings.navbar.alerts': 'alerts', 'settings.menu': 'Menu', + 'settings.topMenu': 'Top Menu', 'settings.tabBar': 'Tab Bar', 'settings.footer': 'Footer', 'settings.otherSettings': 'Other Settings', diff --git a/arco-design-pro-vite/src/locale/zh-CN/settings.ts b/arco-design-pro-vite/src/locale/zh-CN/settings.ts index e762418..e42021d 100644 --- a/arco-design-pro-vite/src/locale/zh-CN/settings.ts +++ b/arco-design-pro-vite/src/locale/zh-CN/settings.ts @@ -12,6 +12,7 @@ export default { 'settings.navbar.screen.toExit': '点击退出全屏模式', 'settings.navbar.alerts': '消息通知', 'settings.menu': '菜单栏', + 'settings.topMenu': '顶部菜单栏', 'settings.tabBar': '多页签', 'settings.footer': '底部', 'settings.otherSettings': '其他设置', diff --git a/arco-design-pro-vite/src/store/modules/app/types.ts b/arco-design-pro-vite/src/store/modules/app/types.ts index e45b2c4..4229f83 100644 --- a/arco-design-pro-vite/src/store/modules/app/types.ts +++ b/arco-design-pro-vite/src/store/modules/app/types.ts @@ -5,6 +5,7 @@ export interface AppState { colorWeak: boolean; navbar: boolean; menu: boolean; + topMenu: boolean; hideMenu: boolean; menuCollapse: boolean; footer: boolean;