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
17a96398
Commit
17a96398
authored
Jun 19, 2020
by
Sendya
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: prop back and event @back check
parent
ca83d764
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
11 deletions
+7
-11
step-form.vue
examples/src/views/form/step-form.vue
+2
-6
index.jsx
src/components/PageHeaderWrapper/index.jsx
+5
-5
No files found.
examples/src/views/form/step-form.vue
View file @
17a96398
...
@@ -6,12 +6,8 @@
...
@@ -6,12 +6,8 @@
this.tabActiveKey = key
this.tabActiveKey = key
console.log('PageHeader::tabChange', key)
console.log('PageHeader::tabChange', key)
}"
}"
@back="() => {
@back="(e) => {
console.log('PageHeader::@back')
console.log('PageHeader::back', e)
}"
:back="() => {
// 自定义 back,不会覆盖 onBack 事件
console.log('PageHeader::.back')
}"
}"
:breadcrumb="customBreadcrumb"
:breadcrumb="customBreadcrumb"
>
>
...
...
src/components/PageHeaderWrapper/index.jsx
View file @
17a96398
...
@@ -113,7 +113,6 @@ const defaultPageHeaderRender = (h, props, pageMeta, i18nRender) => {
...
@@ -113,7 +113,6 @@ const defaultPageHeaderRender = (h, props, pageMeta, i18nRender) => {
breadcrumb
,
breadcrumb
,
extra
,
extra
,
title
:
i18nRender
(
pageHeaderTitle
),
title
:
i18nRender
(
pageHeaderTitle
),
onBack
:
handleBack
||
noop
,
footer
:
renderFooter
(
h
,
restProps
,
i18nRender
),
footer
:
renderFooter
(
h
,
restProps
,
i18nRender
),
}
}
if
(
!
handleBack
)
{
if
(
!
handleBack
)
{
...
@@ -121,7 +120,7 @@ const defaultPageHeaderRender = (h, props, pageMeta, i18nRender) => {
...
@@ -121,7 +120,7 @@ const defaultPageHeaderRender = (h, props, pageMeta, i18nRender) => {
}
}
return
(
return
(
<
PageHeader
{
...
{
props
:
tabProps
}}
>
<
PageHeader
{
...
{
props
:
tabProps
}}
onBack=
{
handleBack
||
noop
}
>
{
renderPageHeader
(
h
,
content
,
extraContent
)
}
{
renderPageHeader
(
h
,
content
,
extraContent
)
}
</
PageHeader
>
</
PageHeader
>
)
)
...
@@ -133,7 +132,7 @@ const PageHeaderWrapper = {
...
@@ -133,7 +132,7 @@ const PageHeaderWrapper = {
props
:
PageHeaderWrapperProps
,
props
:
PageHeaderWrapperProps
,
inject
:
[
'locale'
,
'contentWidth'
,
'breadcrumbRender'
],
inject
:
[
'locale'
,
'contentWidth'
,
'breadcrumbRender'
],
render
(
h
)
{
render
(
h
)
{
const
{
$route
}
=
this
const
{
$route
,
$listeners
}
=
this
const
children
=
this
.
$slots
.
default
const
children
=
this
.
$slots
.
default
const
content
=
getComponentFromProp
(
this
,
'content'
)
const
content
=
getComponentFromProp
(
this
,
'content'
)
const
extra
=
getComponentFromProp
(
this
,
'extra'
)
const
extra
=
getComponentFromProp
(
this
,
'extra'
)
...
@@ -143,9 +142,10 @@ const PageHeaderWrapper = {
...
@@ -143,9 +142,10 @@ const PageHeaderWrapper = {
const
i18n
=
this
.
$props
.
i18nRender
||
this
.
locale
||
defaultI18nRender
const
i18n
=
this
.
$props
.
i18nRender
||
this
.
locale
||
defaultI18nRender
const
contentWidth
=
this
.
$props
.
contentWidth
||
this
.
contentWidth
||
false
const
contentWidth
=
this
.
$props
.
contentWidth
||
this
.
contentWidth
||
false
// 当未设置 back props 或未监听 @back,不显示 back
// 当未设置 back props 或未监听 @back,不显示 back
const
onBack
=
this
.
$props
.
back
// props 的 back 事件优先级高于 @back,需要注意
const
onBack
=
this
.
$props
.
back
||
$listeners
.
back
const
back
=
onBack
&&
(()
=>
{
const
back
=
onBack
&&
(()
=>
{
this
.
$emit
(
'back'
)
//
this.$emit('back')
// call props back func
// call props back func
onBack
&&
onBack
()
onBack
&&
onBack
()
})
||
undefined
})
||
undefined
...
...
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