Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
pro-layout
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
packages
pro-layout
Commits
5f70ec85
Commit
5f70ec85
authored
Oct 22, 2021
by
Sendya
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: render props check
parent
6e7be526
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
119 additions
and
151 deletions
+119
-151
README.md
README.md
+2
-2
package.json
package.json
+1
-1
index.tsx
src/FooterToolbar/index.tsx
+37
-44
headerProps.ts
src/GlobalHeader/headerProps.ts
+2
-2
Header.tsx
src/Header.tsx
+3
-3
index.tsx
src/PageContainer/index.tsx
+4
-4
SiderMenu.tsx
src/SiderMenu/SiderMenu.tsx
+70
-95
No files found.
README.md
View file @
5f70ec85
...
@@ -101,8 +101,8 @@ const layoutConf = reactive({
...
@@ -101,8 +101,8 @@ const layoutConf = reactive({
| loading | layout loading status | boolean | - |
| loading | layout loading status | boolean | - |
| layout | layout menu mode, sidemenu: right navigation, topmenu: top navigation | 'side'
\|
'top'
\|
'mix' |
`'side'`
|
| layout | layout menu mode, sidemenu: right navigation, topmenu: top navigation | 'side'
\|
'top'
\|
'mix' |
`'side'`
|
| contentWidth | content mode of layout, Fluid: adaptive, Fixed: fixed width 1200px | 'Fixed'
\|
'Fluid' |
`Fluid`
|
| contentWidth | content mode of layout, Fluid: adaptive, Fixed: fixed width 1200px | 'Fixed'
\|
'Fluid' |
`Fluid`
|
|
theme | Navigation menu theme | 'light'
\|
'dark' |
`'light'`
|
|
navTheme | Navigation theme | 'light'
\|
'dark' |
`'light'`
|
|
navTheme | Navigation
Bar theme | 'light'
\|
'dark' |
`'light'`
|
|
headerTheme | Header
Bar theme | 'light'
\|
'dark' |
`'light'`
|
| menuData | Vue-router
`routes`
prop | Object |
`[{}]`
|
| menuData | Vue-router
`routes`
prop | Object |
`[{}]`
|
| collapsed | control menu's collapse and expansion | boolean | true |
| collapsed | control menu's collapse and expansion | boolean | true |
| selectedKeys | menu selected keys | string
[]
|
`[]`
|
| selectedKeys | menu selected keys | string
[]
|
`[]`
|
...
...
package.json
View file @
5f70ec85
{
{
"name"
:
"@ant-design-vue/pro-layout"
,
"name"
:
"@ant-design-vue/pro-layout"
,
"version"
:
"3.1.
1
"
,
"version"
:
"3.1.
2
"
,
"license"
:
"
MIT
"
,
"license"
:
"
MIT
"
,
"files"
:
[
"files"
:
[
"dist"
"dist"
...
...
src/FooterToolbar/index.tsx
View file @
5f70ec85
import
'./index.less'
import
'./index.less'
;
import
{
import
{
computed
,
defineComponent
,
onBeforeUnmount
,
onMounted
,
unref
,
PropType
}
from
'vue'
;
computed
,
import
{
RouteContextProps
,
useRouteContext
}
from
'../RouteContext'
;
defineComponent
,
import
{
getPropsSlotfn
}
from
'../utils'
;
onBeforeUnmount
,
import
type
{
CustomRender
}
from
'../typings'
;
onMounted
,
unref
,
PropType
,
}
from
'vue'
import
{
RouteContextProps
,
useRouteContext
}
from
'../RouteContext'
import
{
getPropsSlotfn
}
from
'../utils'
import
type
{
CustomRender
}
from
'../typings'
export
interface
FooterToolbarProps
{
export
interface
FooterToolbarProps
{
extra
?:
CustomRender
|
JSX
.
Element
extra
?:
CustomRender
|
JSX
.
Element
;
renderContent
?:
(
renderContent
?:
(
props
:
FooterToolbarProps
&
RouteContextProps
&
{
leftWidth
?:
string
},
props
:
FooterToolbarProps
&
RouteContextProps
&
{
leftWidth
?:
string
},
dom
:
CustomRender
|
JSX
.
Element
dom
:
CustomRender
|
JSX
.
Element
,
)
=>
CustomRender
|
JSX
.
Element
)
=>
CustomRender
|
JSX
.
Element
;
getContainer
?:
(
triggerNode
:
HTMLElement
)
=>
HTMLElement
|
null
getContainer
?:
(
triggerNode
:
HTMLElement
)
=>
HTMLElement
|
null
;
prefixCls
?:
string
prefixCls
?:
string
;
}
}
const
footerToolbarProps
=
{
const
footerToolbarProps
=
{
extra
:
{
extra
:
{
type
:
Object
as
PropType
<
FooterToolbarProps
[
'extra'
]
>
,
type
:
[
Function
,
Object
,
Boolean
]
as
PropType
<
FooterToolbarProps
[
'extra'
]
>
,
},
},
renderContent
:
{
renderContent
:
{
type
:
[
Function
,
Object
]
as
PropType
<
FooterToolbarProps
[
'renderContent'
]
>
,
type
:
[
Function
,
Object
,
Boolean
]
as
PropType
<
FooterToolbarProps
[
'renderContent'
]
>
,
},
},
getContainer
:
{
getContainer
:
{
type
:
[
Function
,
Object
]
as
PropType
<
FooterToolbarProps
[
'getContainer'
]
>
,
type
:
[
Function
,
Object
]
as
PropType
<
FooterToolbarProps
[
'getContainer'
]
>
,
},
},
prefixCls
:
{
type
:
String
as
PropType
<
string
>
},
prefixCls
:
{
type
:
String
as
PropType
<
string
>
},
}
}
;
const
FooterToolbar
=
defineComponent
({
const
FooterToolbar
=
defineComponent
({
name
:
'FooterToolbar'
,
name
:
'FooterToolbar'
,
props
:
footerToolbarProps
,
props
:
footerToolbarProps
,
setup
(
props
,
{
slots
})
{
setup
(
props
,
{
slots
})
{
const
context
=
useRouteContext
()
const
context
=
useRouteContext
()
;
const
baseClassName
=
props
.
prefixCls
||
context
.
getPrefixCls
(
'footer-bar'
)
const
baseClassName
=
props
.
prefixCls
||
context
.
getPrefixCls
(
'footer-bar'
)
;
const
hasFlatMenu
=
computed
(()
=>
{
const
hasFlatMenu
=
computed
(()
=>
{
return
unref
(
context
.
flatMenuData
).
length
>
0
return
unref
(
context
.
flatMenuData
).
length
>
0
;
})
})
;
const
width
=
computed
(()
=>
{
const
width
=
computed
(()
=>
{
const
{
isMobile
,
hasSide
,
siderWidth
,
layout
}
=
context
const
{
isMobile
,
hasSide
,
siderWidth
,
layout
}
=
context
;
if
(
!
siderWidth
||
layout
===
'top'
)
{
if
(
!
siderWidth
||
layout
===
'top'
)
{
return
'100%'
return
'100%'
;
}
}
console
.
log
(
console
.
log
(
'x'
,
'x'
,
...
@@ -55,24 +48,24 @@ const FooterToolbar = defineComponent({
...
@@ -55,24 +48,24 @@ const FooterToolbar = defineComponent({
'hasFlatMenu'
,
'hasFlatMenu'
,
unref
(
hasFlatMenu
),
unref
(
hasFlatMenu
),
'hasSide'
,
'hasSide'
,
unref
(
context
.
hasSide
)
unref
(
context
.
hasSide
)
,
)
)
;
if
(
!
hasFlatMenu
.
value
&&
!
unref
(
hasSide
))
{
if
(
!
hasFlatMenu
.
value
&&
!
unref
(
hasSide
))
{
return
'100%'
return
'100%'
;
}
}
console
.
log
(
'x2'
,
unref
(
context
.
hasSide
))
console
.
log
(
'x2'
,
unref
(
context
.
hasSide
))
;
return
isMobile
?
'100%'
:
`calc(100% -
${
siderWidth
}
px)`
return
isMobile
?
'100%'
:
`calc(100% -
${
siderWidth
}
px)`
;
})
})
;
onMounted
(()
=>
{
onMounted
(()
=>
{
context
.
setHasFooterToolbar
&&
context
.
setHasFooterToolbar
(
true
)
context
.
setHasFooterToolbar
&&
context
.
setHasFooterToolbar
(
true
)
;
})
})
;
onBeforeUnmount
(()
=>
{
onBeforeUnmount
(()
=>
{
context
.
setHasFooterToolbar
&&
context
.
setHasFooterToolbar
(
false
)
context
.
setHasFooterToolbar
&&
context
.
setHasFooterToolbar
(
false
)
;
})
})
;
return
()
=>
{
return
()
=>
{
const
extra
=
getPropsSlotfn
(
slots
,
props
,
'extra'
)
const
extra
=
getPropsSlotfn
(
slots
,
props
,
'extra'
)
;
const
dom
=
()
=>
{
const
dom
=
()
=>
{
return
(
return
(
<>
<>
...
@@ -81,8 +74,8 @@ const FooterToolbar = defineComponent({
...
@@ -81,8 +74,8 @@ const FooterToolbar = defineComponent({
</
div
>
</
div
>
<
div
class=
{
`${baseClassName}-right`
}
>
{
slots
.
default
?.()
}
</
div
>
<
div
class=
{
`${baseClassName}-right`
}
>
{
slots
.
default
?.()
}
</
div
>
</>
</>
)
)
;
}
}
;
return
(
return
(
<
div
class=
{
baseClassName
}
style=
{
{
width
:
width
.
value
}
}
>
<
div
class=
{
baseClassName
}
style=
{
{
width
:
width
.
value
}
}
>
{
props
.
renderContent
{
props
.
renderContent
...
@@ -92,13 +85,13 @@ const FooterToolbar = defineComponent({
...
@@ -92,13 +85,13 @@ const FooterToolbar = defineComponent({
...
context
,
...
context
,
leftWidth
:
width
.
value
,
leftWidth
:
width
.
value
,
},
},
dom
()
dom
()
,
)
)
:
dom
()
}
:
dom
()
}
</
div
>
</
div
>
)
)
;
}
}
;
},
},
})
})
;
export
default
FooterToolbar
export
default
FooterToolbar
;
src/GlobalHeader/headerProps.ts
View file @
5f70ec85
...
@@ -21,7 +21,7 @@ export default {
...
@@ -21,7 +21,7 @@ export default {
},
},
splitMenus
:
siderMenuProps
.
splitMenus
,
splitMenus
:
siderMenuProps
.
splitMenus
,
menuRender
:
{
menuRender
:
{
type
:
[
Object
,
Function
]
as
PropType
<
type
:
[
Object
,
Function
,
Boolean
]
as
PropType
<
WithFalse
<
(
props
:
any
/* HeaderViewProps */
,
defaultDom
:
CustomRender
)
=>
CustomRender
>
WithFalse
<
(
props
:
any
/* HeaderViewProps */
,
defaultDom
:
CustomRender
)
=>
CustomRender
>
>
,
>
,
default
:
()
=>
undefined
,
default
:
()
=>
undefined
,
...
@@ -30,7 +30,7 @@ export default {
...
@@ -30,7 +30,7 @@ export default {
menuItemRender
:
siderMenuProps
.
menuItemRender
,
menuItemRender
:
siderMenuProps
.
menuItemRender
,
subMenuItemRender
:
siderMenuProps
.
subMenuItemRender
,
subMenuItemRender
:
siderMenuProps
.
subMenuItemRender
,
rightContentRender
:
{
rightContentRender
:
{
type
:
[
Object
,
Function
]
as
PropType
<
WithFalse
<
(
props
:
any
)
=>
CustomRender
>>
,
type
:
[
Object
,
Function
,
Boolean
]
as
PropType
<
WithFalse
<
(
props
:
any
)
=>
CustomRender
>>
,
default
:
()
=>
undefined
,
default
:
()
=>
undefined
,
},
},
collapsedButtonRender
:
siderMenuProps
.
collapsedButtonRender
,
collapsedButtonRender
:
siderMenuProps
.
collapsedButtonRender
,
...
...
src/Header.tsx
View file @
5f70ec85
...
@@ -18,19 +18,19 @@ const { Header } = Layout;
...
@@ -18,19 +18,19 @@ const { Header } = Layout;
export
const
headerViewProps
=
{
export
const
headerViewProps
=
{
...
globalHeaderProps
,
...
globalHeaderProps
,
headerRender
:
{
headerRender
:
{
type
:
[
Object
,
Function
]
as
PropType
<
type
:
[
Object
,
Function
,
Boolean
]
as
PropType
<
WithFalse
<
(
props
:
any
,
defaultDom
:
CustomRender
)
=>
CustomRender
>
WithFalse
<
(
props
:
any
,
defaultDom
:
CustomRender
)
=>
CustomRender
>
>
,
>
,
default
:
()
=>
undefined
,
default
:
()
=>
undefined
,
},
},
headerTitleRender
:
{
headerTitleRender
:
{
type
:
[
Object
,
Function
]
as
PropType
<
type
:
[
Object
,
Function
,
Boolean
]
as
PropType
<
WithFalse
<
(
props
:
any
,
defaultDom
:
CustomRender
)
=>
CustomRender
>
WithFalse
<
(
props
:
any
,
defaultDom
:
CustomRender
)
=>
CustomRender
>
>
,
>
,
default
:
()
=>
undefined
,
default
:
()
=>
undefined
,
},
},
headerContentRender
:
{
headerContentRender
:
{
type
:
[
Object
,
Function
]
as
PropType
<
WithFalse
<
(
props
:
any
)
=>
CustomRender
>>
,
type
:
[
Object
,
Function
,
Boolean
]
as
PropType
<
WithFalse
<
(
props
:
any
)
=>
CustomRender
>>
,
default
:
()
=>
undefined
,
default
:
()
=>
undefined
,
},
},
hasSiderMenu
:
PropTypes
.
looseBool
,
hasSiderMenu
:
PropTypes
.
looseBool
,
...
...
src/PageContainer/index.tsx
View file @
5f70ec85
...
@@ -12,7 +12,7 @@ import {
...
@@ -12,7 +12,7 @@ import {
import
omit
from
'omit.js'
;
import
omit
from
'omit.js'
;
import
{
withInstall
}
from
'ant-design-vue/es/_util/type'
;
import
{
withInstall
}
from
'ant-design-vue/es/_util/type'
;
import
PageHeader
,
{
pageHeaderProps
}
from
'ant-design-vue/es/page-header'
;
import
PageHeader
,
{
pageHeaderProps
}
from
'ant-design-vue/es/page-header'
;
import
{
Tabs
,
Affix
,
Spin
,
}
from
'ant-design-vue'
;
import
{
Tabs
,
Affix
,
Spin
}
from
'ant-design-vue'
;
import
{
TabPaneProps
}
from
'./interfaces/TabPane'
;
import
{
TabPaneProps
}
from
'./interfaces/TabPane'
;
import
{
TabBarExtraContent
,
TabsProps
}
from
'./interfaces/Tabs'
;
import
{
TabBarExtraContent
,
TabsProps
}
from
'./interfaces/Tabs'
;
import
{
AffixProps
}
from
'./interfaces/Affix'
;
import
{
AffixProps
}
from
'./interfaces/Affix'
;
...
@@ -50,7 +50,7 @@ export const pageHeaderTabConfig = {
...
@@ -50,7 +50,7 @@ export const pageHeaderTabConfig = {
* @name tab 上多余的区域
* @name tab 上多余的区域
*/
*/
tabBarExtraContent
:
{
tabBarExtraContent
:
{
type
:
[
Object
,
Function
]
as
PropType
<
TabBarExtraContent
>
,
type
:
[
Object
,
Function
,
Boolean
]
as
PropType
<
TabBarExtraContent
>
,
default
:
()
=>
undefined
,
default
:
()
=>
undefined
,
},
},
/**
/**
...
@@ -206,9 +206,9 @@ const defaultPageHeaderRender = (
...
@@ -206,9 +206,9 @@ const defaultPageHeaderRender = (
if
(
!
title
&&
title
!==
false
)
{
if
(
!
title
&&
title
!==
false
)
{
pageHeaderTitle
=
value
.
title
;
pageHeaderTitle
=
value
.
title
;
}
}
const
unrefBreadcrumb
=
unref
(
value
.
breadcrumb
||
{})
const
unrefBreadcrumb
=
unref
(
value
.
breadcrumb
||
{})
;
const
breadcrumb
=
restProps
.
breadcrumb
||
{
const
breadcrumb
=
restProps
.
breadcrumb
||
{
...
(
unrefBreadcrumb
)
,
...
unrefBreadcrumb
,
routes
:
unrefBreadcrumb
.
routes
,
routes
:
unrefBreadcrumb
.
routes
,
itemRender
:
unrefBreadcrumb
.
itemRender
,
itemRender
:
unrefBreadcrumb
.
itemRender
,
};
};
...
...
src/SiderMenu/SiderMenu.tsx
View file @
5f70ec85
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment