Commit b2f35b9c authored by liangliangyin's avatar liangliangyin

fix: collapsed sidermenu paddingLeft

parent 1b05b728
{
"name": "@ant-design-vue/pro-layout",
"version": "0.2.7",
"version": "0.2.8",
"main": "./lib/index.js",
"module": "./es/index.js",
"repository": {
......
......@@ -63,6 +63,17 @@ const MediaQueryEnum = {
}
}
const getPaddingLeft = (
hasLeftPadding,
collapsed = undefined,
siderWidth
) => {
if (hasLeftPadding) {
return collapsed ? 80 : siderWidth
}
return undefined
}
const headerRender = (h, props) => {
if (props.headerRender === false) {
return null
......@@ -97,10 +108,14 @@ const BasicLayout = {
const collapsedButtonRender = getComponentFromProp(content, 'collapsedButtonRender')
const menuHeaderRender = getComponentFromProp(content, 'menuHeaderRender')
const isTopMenu = layout === 'topmenu'
const hasSiderMenu = !isTopMenu
// If it is a fix menu, calculate padding
// don't need padding in phone mode
const hasLeftPadding = fixSiderbar && !isTopMenu && !isMobile
const cdProps = {
...props,
hasSiderMenu: !isTopMenu,
hasSiderMenu,
footerRender,
menuHeaderRender,
rightContentRender,
......@@ -121,7 +136,9 @@ const BasicLayout = {
onCollapse={handleCollapse}
/>
<Layout class={[layout]} style={{
paddingLeft: fixSiderbar ? `${siderWidth}px` : '0',
paddingLeft: hasSiderMenu
? `${getPaddingLeft(!!hasLeftPadding, collapsed, siderWidth)}px`
: undefined,
minHeight: '100vh'
}}>
{headerRender(h, {
......
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