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
cde3eb58
Unverified
Commit
cde3eb58
authored
Aug 13, 2021
by
Sendya
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: page-container slots not reacitve
parent
cb390cf6
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
98 additions
and
76 deletions
+98
-76
main.ts
examples/main.ts
+1
-1
page1.vue
examples/views/page1.vue
+19
-9
package.json
package.json
+1
-1
BasicLayout.tsx
src/BasicLayout.tsx
+1
-1
Header.tsx
src/Header.tsx
+1
-1
index.tsx
src/PageContainer/index.tsx
+74
-62
WrapContent.tsx
src/WrapContent.tsx
+1
-1
No files found.
examples/main.ts
View file @
cde3eb58
...
@@ -6,7 +6,7 @@ import router from './router';
...
@@ -6,7 +6,7 @@ import router from './router';
import
icons
from
'./icons'
;
import
icons
from
'./icons'
;
import
App
from
'./App.vue'
;
import
App
from
'./App.vue'
;
import
'../dist/style.less'
;
//
import '../dist/style.less';
import
ProLayout
,
{
PageContainer
}
from
'../src'
;
// '../dist/pro-layout.es';
import
ProLayout
,
{
PageContainer
}
from
'../src'
;
// '../dist/pro-layout.es';
const
app
=
createApp
(
App
);
const
app
=
createApp
(
App
);
...
...
examples/views/page1.vue
View file @
cde3eb58
<
template
>
<
template
>
<PageContainer
title=
"Page 1"
sub-title=
"is a sub-title."
>
<page-container
title=
"Page 1"
sub-title=
"is a sub-title."
>
<template
#
content
>
<div>
container.content
<h1>
{{
text
}}
</h1>
</div>
</
template
>
<span>
page-content
</span>
<span>
page-content
</span>
<a-button
@
click=
"handleClick"
>
Button
</a-button>
<a-button
@
click=
"handleClick"
>
Button
</a-button>
</
PageC
ontainer>
</
page-c
ontainer>
</template>
</template>
<
script
lang=
"ts"
>
<
script
lang=
"ts"
>
import
{
defineComponent
}
from
'vue'
;
import
{
defineComponent
,
ref
}
from
'vue'
;
import
{
Button
,
message
}
from
'ant-design-vue'
;
import
{
Button
,
message
}
from
'ant-design-vue'
;
export
default
defineComponent
({
export
default
defineComponent
({
components
:{
components
:
{
[
Button
.
name
]:
Button
,
[
Button
.
name
]:
Button
,
},
},
setup
()
{
setup
()
{
const
handleClick
=
()
=>
{
const
text
=
ref
<
string
>
(
'1'
);
message
.
info
(
'clicked'
)
const
handleClick
=
()
=>
{
}
message
.
info
(
'clicked'
);
text
.
value
=
`
${
Math
.
random
()}
`
;
};
return
{
return
{
handleClick
,
handleClick
,
}
text
,
};
},
},
})
})
;
</
script
>
</
script
>
package.json
View file @
cde3eb58
{
{
"name"
:
"@ant-design-vue/pro-layout"
,
"name"
:
"@ant-design-vue/pro-layout"
,
"version"
:
"3.1.0-alpha.
6
"
,
"version"
:
"3.1.0-alpha.
7
"
,
"license"
:
"
MIT
"
,
"license"
:
"
MIT
"
,
"files"
:
[
"files"
:
[
"dist"
,
"dist"
,
...
...
src/BasicLayout.tsx
View file @
cde3eb58
...
@@ -80,8 +80,8 @@ export type BasicLayoutProps = Partial<ExtractPropTypes<typeof basicLayoutProps>
...
@@ -80,8 +80,8 @@ export type BasicLayoutProps = Partial<ExtractPropTypes<typeof basicLayoutProps>
const
ProLayout
=
defineComponent
({
const
ProLayout
=
defineComponent
({
name
:
'ProLayout'
,
name
:
'ProLayout'
,
inheritAttrs
:
false
,
props
:
basicLayoutProps
,
props
:
basicLayoutProps
,
// inheritAttrs: false,
emits
:
[
emits
:
[
'update:collapsed'
,
'update:collapsed'
,
'update:open-keys'
,
'update:open-keys'
,
...
...
src/Header.tsx
View file @
cde3eb58
...
@@ -40,8 +40,8 @@ export const headerViewProps = {
...
@@ -40,8 +40,8 @@ export const headerViewProps = {
export
type
HeaderViewProps
=
Partial
<
ExtractPropTypes
<
typeof
headerViewProps
>
&
GlobalHeaderProps
>
;
export
type
HeaderViewProps
=
Partial
<
ExtractPropTypes
<
typeof
headerViewProps
>
&
GlobalHeaderProps
>
;
export
const
HeaderView
=
defineComponent
({
export
const
HeaderView
=
defineComponent
({
inheritAttrs
:
false
,
name
:
'HeaderView'
,
name
:
'HeaderView'
,
inheritAttrs
:
false
,
props
:
headerViewProps
,
props
:
headerViewProps
,
setup
(
props
)
{
setup
(
props
)
{
const
{
const
{
...
...
src/PageContainer/index.tsx
View file @
cde3eb58
...
@@ -9,26 +9,26 @@ import {
...
@@ -9,26 +9,26 @@ import {
ExtractPropTypes
,
ExtractPropTypes
,
}
from
'vue'
;
}
from
'vue'
;
/* replace antd ts define */
/* replace antd ts define */
import
{
withInstall
}
from
'ant-design-vue/es/_util/type'
;
import
PageHeader
,
{
pageHeaderProps
}
from
'ant-design-vue/es/page-header'
;
import
Tabs
from
'ant-design-vue/es/tabs'
;
import
Affix
from
'ant-design-vue/es/affix'
;
import
Spin
from
'ant-design-vue/es/spin'
;
import
omit
from
'omit.js'
;
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'
;
/* replace antd ts define end */
/* replace antd ts define end */
import
{
RouteContextProps
,
useRouteContext
}
from
'../RouteContext'
;
import
{
RouteContextProps
,
useRouteContext
}
from
'../RouteContext'
;
import
{
getPropsSlot
}
from
'../utils'
;
import
{
getPropsSlot
,
PropTypes
}
from
'../utils'
;
import
{
withInstall
}
from
'ant-design-vue/es/_util/type'
;
import
'ant-design-vue/es/affix/style'
;
import
'ant-design-vue/es/affix/style'
;
import
Affix
from
'ant-design-vue/es/affix'
;
import
'ant-design-vue/es/page-header/style'
;
import
'ant-design-vue/es/page-header/style'
;
import
PageHeader
,
{
pageHeaderProps
}
from
'ant-design-vue/es/page-header'
;
import
'ant-design-vue/es/tabs/style'
;
import
'ant-design-vue/es/tabs/style'
;
import
Tabs
from
'ant-design-vue/es/tabs'
;
import
'ant-design-vue/es/spin/style'
;
import
'ant-design-vue/es/spin/style'
;
import
Spin
from
'ant-design-vue/es/spin'
;
import
GridContent
from
'../GridContent'
;
import
GridContent
from
'../GridContent'
;
import
FooterToolbar
from
'../FooterToolbar'
;
import
FooterToolbar
from
'../FooterToolbar'
;
import
{
PropTypes
}
from
'../utils'
;
import
{
CustomRender
,
WithFalse
}
from
'../typings'
;
import
{
CustomRender
,
WithFalse
}
from
'../typings'
;
import
omit
from
'omit.js'
;
import
'./index.less'
;
import
'./index.less'
;
export
interface
Tab
{
export
interface
Tab
{
...
@@ -135,8 +135,14 @@ const renderFooter = (
...
@@ -135,8 +135,14 @@ const renderFooter = (
'title'
'title'
>
,
>
,
):
VNodeChild
|
JSX
.
Element
=>
{
):
VNodeChild
|
JSX
.
Element
=>
{
const
{
tabList
,
tabActiveKey
,
onTabChange
,
tabBarExtraContent
,
tabProps
,
prefixedClassName
}
=
const
{
props
;
tabList
,
tabActiveKey
,
onTabChange
,
tabBarExtraContent
,
tabProps
,
prefixedClassName
,
}
=
props
;
if
(
tabList
&&
tabList
.
length
)
{
if
(
tabList
&&
tabList
.
length
)
{
return
(
return
(
<
Tabs
<
Tabs
...
@@ -233,6 +239,7 @@ const defaultPageHeaderRender = (
...
@@ -233,6 +239,7 @@ const defaultPageHeaderRender = (
const
PageContainer
=
defineComponent
({
const
PageContainer
=
defineComponent
({
name
:
'PageContainer'
,
name
:
'PageContainer'
,
inheritAttrs
:
false
,
props
:
pageContainerProps
,
props
:
pageContainerProps
,
setup
(
props
,
{
slots
})
{
setup
(
props
,
{
slots
})
{
const
{
loading
,
affixProps
,
ghost
}
=
toRefs
(
props
);
const
{
loading
,
affixProps
,
ghost
}
=
toRefs
(
props
);
...
@@ -247,60 +254,65 @@ const PageContainer = defineComponent({
...
@@ -247,60 +254,65 @@ const PageContainer = defineComponent({
};
};
});
});
const
tags
=
getPropsSlot
(
slots
,
props
,
'tags'
);
const
headerDom
=
computed
(()
=>
{
const
headerContent
=
getPropsSlot
(
slots
,
props
,
'content
'
);
const
tags
=
getPropsSlot
(
slots
,
props
,
'tags
'
);
const
extra
=
getPropsSlot
(
slots
,
props
,
'extra
'
);
const
headerContent
=
getPropsSlot
(
slots
,
props
,
'content
'
);
const
extraContent
=
getPropsSlot
(
slots
,
props
,
'extraContent
'
);
const
extra
=
getPropsSlot
(
slots
,
props
,
'extra
'
);
const
footer
=
getPropsSlot
(
slots
,
props
,
'footer
'
);
const
extraContent
=
getPropsSlot
(
slots
,
props
,
'extraContent
'
);
const
headerDom
=
computed
(()
=>
(
return
(
<
div
class=
{
`${prefixedClassName.value}-warp`
}
>
<
div
class=
{
`${prefixedClassName.value}-warp`
}
>
{
defaultPageHeaderRender
(
{
defaultPageHeaderRender
(
{
{
...
props
,
...
props
,
tags
,
tags
,
content
:
headerContent
,
content
:
headerContent
,
extra
,
extra
,
extraContent
,
extraContent
,
},
},
{
{
...
value
,
...
value
,
prefixCls
:
undefined
,
prefixCls
:
undefined
,
prefixedClassName
:
prefixedClassName
.
value
,
prefixedClassName
:
prefixedClassName
.
value
,
},
},
)
}
)
}
</
div
>
</
div
>
));
);
});
return
()
=>
(
return
()
=>
{
<
div
class=
{
classNames
.
value
}
>
const
footer
=
getPropsSlot
(
slots
,
props
,
'footer'
);
{
value
.
fixedHeader
?
(
<
Affix
offsetTop=
{
value
.
fixedHeader
?
value
.
headerHeight
:
0
}
{
...
affixProps
.
value
}
>
return
(
{
headerDom
.
value
}
<
div
class=
{
classNames
.
value
}
>
</
Affix
>
{
value
.
fixedHeader
?
(
)
:
(
<
Affix
offsetTop=
{
value
.
fixedHeader
?
value
.
headerHeight
:
0
}
{
...
affixProps
.
value
}
>
headerDom
.
value
{
headerDom
.
value
}
)
}
</
Affix
>
<
GridContent
>
)
:
(
{
loading
.
value
?
(
headerDom
.
value
<
Spin
/>
)
}
)
:
slots
.
default
?
(
<
GridContent
>
<
div
>
{
loading
.
value
?
(
<
div
class=
{
`${prefixedClassName.value}-children-content`
}
>
{
slots
.
default
()
}
</
div
>
<
Spin
/>
{
value
.
hasFooterToolbar
&&
(
)
:
slots
.
default
?
(
<
div
<
div
>
style=
{
{
<
div
class=
{
`${prefixedClassName.value}-children-content`
}
>
{
slots
.
default
()
}
</
div
>
height
:
48
,
{
value
.
hasFooterToolbar
&&
(
marginTop
:
24
,
<
div
}
}
style=
{
{
/>
height
:
48
,
)
}
marginTop
:
24
,
</
div
>
}
}
)
:
null
}
/>
</
GridContent
>
)
}
{
value
.
hasFooterToolbar
&&
<
FooterToolbar
>
{
footer
}
</
FooterToolbar
>
}
</
div
>
</
div
>
)
:
null
}
);
</
GridContent
>
{
value
.
hasFooterToolbar
&&
<
FooterToolbar
>
{
footer
}
</
FooterToolbar
>
}
</
div
>
);
};
},
},
});
});
// <WaterMark content="Pro Layout"></WaterMark>
// <WaterMark content="Pro Layout"></WaterMark>
...
...
src/WrapContent.tsx
View file @
cde3eb58
...
@@ -8,7 +8,7 @@ const { Content } = Layout;
...
@@ -8,7 +8,7 @@ const { Content } = Layout;
export
interface
WrapContentProps
{
export
interface
WrapContentProps
{
style
?:
CSSProperties
;
style
?:
CSSProperties
;
class
?:
string
|
string
[]
|
object
;
class
?:
string
|
string
[]
|
any
;
isChildrenLayout
?:
boolean
;
isChildrenLayout
?:
boolean
;
location
?:
string
|
string
[]
|
any
;
location
?:
string
|
string
[]
|
any
;
contentHeight
?:
number
;
contentHeight
?:
number
;
...
...
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