Unverified Commit f101c494 authored by Sendya's avatar Sendya

fix: menu trigger

parent f64a3937
...@@ -19,7 +19,6 @@ ...@@ -19,7 +19,6 @@
"@ant-design/icons": "^4.0.0-alpha.11", "@ant-design/icons": "^4.0.0-alpha.11",
"ant-design-vue": "^1.4.8", "ant-design-vue": "^1.4.8",
"core-js": "^3.1.2", "core-js": "^3.1.2",
"vue": "^2.6.10",
"vue-i18n": "^8.15.0", "vue-i18n": "^8.15.0",
"vue-ls": "^3.2.1", "vue-ls": "^3.2.1",
"vue-router": "^3.0.6", "vue-router": "^3.0.6",
......
...@@ -25,7 +25,7 @@ const SelectLang = { ...@@ -25,7 +25,7 @@ const SelectLang = {
this.setLang(key) this.setLang(key)
} }
const langMenu = ( const langMenu = (
<Menu class={'menu'} selectedKeys={[this.currentLang]} onClick={changeLang}> <Menu class={['menu', 'drop-down']} selectedKeys={[this.currentLang]} onClick={changeLang}>
{locales.map(locale => ( {locales.map(locale => (
<Menu.Item key={locale}> <Menu.Item key={locale}>
<span role="img" aria-label={languageLabels[locale]}> <span role="img" aria-label={languageLabels[locale]}>
......
...@@ -15,10 +15,6 @@ ...@@ -15,10 +15,6 @@
} }
} }
.anticon {
margin-right: 8px;
}
&.select-lang { &.select-lang {
.ant-dropdown-menu-item { .ant-dropdown-menu-item {
min-width: 120px; min-width: 120px;
......
...@@ -37,8 +37,12 @@ const Account = { ...@@ -37,8 +37,12 @@ const Account = {
} }
const rightContentRender = (h, props) => { const rightContentRender = (h, props) => {
const cls = {
'ant-pro-global-header-index-right': true,
[`ant-pro-global-header-index-${props.theme}`]: true
}
return ( return (
<div class="ant-pro-global-header-index-right"> <div class={cls}>
<Account class={'ant-pro-global-header-index-action'} /> <Account class={'ant-pro-global-header-index-action'} />
<SelectLang class={'ant-pro-global-header-index-action'} /> <SelectLang class={'ant-pro-global-header-index-action'} />
</div> </div>
...@@ -66,7 +70,9 @@ export default { ...@@ -66,7 +70,9 @@ export default {
// 布局类型 // 布局类型
layout: 'sidemenu', // 'sidemenu', 'topmenu' layout: 'sidemenu', // 'sidemenu', 'topmenu'
// 定宽: true / 流式: false // 定宽: true / 流式: false
contentWidth: true contentWidth: true,
// 主题
theme: 'dark'
} }
}, },
render (h) { render (h) {
...@@ -74,7 +80,8 @@ export default { ...@@ -74,7 +80,8 @@ export default {
collapsed, collapsed,
contentWidth, contentWidth,
autoHideHeader, autoHideHeader,
layout layout,
theme
} = this } = this
const handleMediaQuery = (val) => { const handleMediaQuery = (val) => {
...@@ -95,6 +102,7 @@ export default { ...@@ -95,6 +102,7 @@ export default {
handleCollapse, handleCollapse,
layout, layout,
contentWidth, contentWidth,
theme,
rightContentRender, rightContentRender,
footerRender, footerRender,
i18nRender, i18nRender,
......
@import "~ant-design-vue/es/style/themes/default"; @import "~ant-design-vue/es/style/themes/default";
.ant-pro-global-header-index-right { .ant-pro-global-header-index-right {
&.ant-pro-global-header-index-dark {
.ant-pro-global-header-index-action {
color: hsla(0,0%,100%,.85);
&:hover {
background: #1890ff;
}
}
}
.account { .account {
.antd-pro-global-header-index-avatar { .antd-pro-global-header-index-avatar {
margin: ~'calc((@{layout-header-height} - 24px) / 2)' 0; margin: ~'calc((@{layout-header-height} - 24px) / 2)' 0;
margin-right: 8px; margin-right: 8px;
...@@ -21,3 +28,4 @@ ...@@ -21,3 +28,4 @@
} }
} }
} }
...@@ -83,6 +83,7 @@ const BasicLayout = { ...@@ -83,6 +83,7 @@ const BasicLayout = {
layout, layout,
logo, logo,
contentWidth, contentWidth,
theme,
collapsed, collapsed,
// eslint-disable-next-line // eslint-disable-next-line
collapsedButtonRender, autoHideHeader, collapsedButtonRender, autoHideHeader,
...@@ -100,35 +101,17 @@ const BasicLayout = { ...@@ -100,35 +101,17 @@ const BasicLayout = {
<SiderMenuWrapper <SiderMenuWrapper
{ ...{ props: props } } { ...{ props: props } }
menus={menus} menus={menus}
theme={'dark'}
mode={'inline'} mode={'inline'}
logo={logo} logo={logo}
isMobile={false}
collapsed={collapsed} collapsed={collapsed}
onCollapse={handleCollapse} onCollapse={handleCollapse}
handleCollapse={handleCollapse} handleCollapse={handleCollapse}
title='Ant Design Pro'
/> />
)} )}
<Layout class={[layout]} style={{ paddingLeft: '0', minHeight: '100vh' }}> <Layout class={[layout]} style={{ paddingLeft: '0', minHeight: '100vh' }}>
{/* <HeaderView
menus={menus}
contentWidth={contentWidth}
layout={layout}
theme={'dark'}
mode={'horizontal'}
logo={LogoSvg}
collapsed={collapsed}
handleCollapse={handleCollapse}
collapsedButtonRender={collapsedButtonRender}
autoHideHeader={autoHideHeader}
headerRender={headerRender}
title='Ant Design Pro' /> */}
{headerRender(h, { {headerRender(h, {
...props, ...props,
theme: 'dark',
mode: 'horizontal', mode: 'horizontal',
title: 'Ant Design Pro'
})} })}
<Layout.Content style={{ margin: '24px 16px', padding: '24px', minHeight: '280px' }}> <Layout.Content style={{ margin: '24px 16px', padding: '24px', minHeight: '280px' }}>
<GridContent contentWidth={contentWidth}> <GridContent contentWidth={contentWidth}>
......
...@@ -51,7 +51,8 @@ const renderContent = (h, props) => { ...@@ -51,7 +51,8 @@ const renderContent = (h, props) => {
const maxWidth = 1200 - 280 - 120 const maxWidth = 1200 - 280 - 120
const contentWidth = props.contentWidth const contentWidth = props.contentWidth
const baseCls = 'ant-pro-top-nav-header' const baseCls = 'ant-pro-top-nav-header'
const { logo, title, theme, headerRender } = props const { logo, title, theme, headerRender, rightContentRender } = props
const rightContentProps = { theme }
let defaultDom = <GlobalHeader {...{ props: props }} /> let defaultDom = <GlobalHeader {...{ props: props }} />
if (isTop && !isMobile) { if (isTop && !isMobile) {
defaultDom = ( defaultDom = (
...@@ -65,6 +66,7 @@ const renderContent = (h, props) => { ...@@ -65,6 +66,7 @@ const renderContent = (h, props) => {
<div class={`${baseCls}-menu`} style={{ maxWidth: `${maxWidth}px`, flex: 1 }}> <div class={`${baseCls}-menu`} style={{ maxWidth: `${maxWidth}px`, flex: 1 }}>
<RouteMenu {...{ props: props }} /> <RouteMenu {...{ props: props }} />
</div> </div>
{rightContentRender(h, rightContentProps)}
</div> </div>
</div> </div>
) )
......
...@@ -157,3 +157,14 @@ ...@@ -157,3 +157,14 @@
} }
} }
} }
.drop-down {
&.menu {
.anticon {
margin-right: 8px;
}
.ant-dropdown-menu-item {
min-width: 160px;
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment