-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
feat: update pageheader #2365
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
feat: update pageheader #2365
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
import { inject } from 'vue'; | ||
import PropTypes from '../_util/vue-types'; | ||
import { getComponentFromProp, getOptionProps } from '../_util/props-util'; | ||
import { getComponent, getOptionProps } from '../_util/props-util'; | ||
import { ConfigConsumerProps } from '../config-provider'; | ||
import ArrowLeftOutlined from '@ant-design/icons-vue/ArrowLeftOutlined'; | ||
import Breadcrumb from '../breadcrumb'; | ||
import Avatar from '../avatar'; | ||
import TransButton from '../_util/transButton'; | ||
import LocaleReceiver from '../locale-provider/LocaleReceiver'; | ||
import Base from '../base'; | ||
|
||
export const PageHeaderProps = { | ||
backIcon: PropTypes.any, | ||
|
@@ -52,17 +52,17 @@ const renderBreadcrumb = (h, breadcrumb) => { | |
|
||
const renderTitle = (h, prefixCls, instance) => { | ||
const { avatar } = instance; | ||
const title = getComponentFromProp(instance, 'title'); | ||
const subTitle = getComponentFromProp(instance, 'subTitle'); | ||
const tags = getComponentFromProp(instance, 'tags'); | ||
const extra = getComponentFromProp(instance, 'extra'); | ||
const title = getComponent(instance, 'title'); | ||
const subTitle = getComponent(instance, 'subTitle'); | ||
const tags = getComponent(instance, 'tags'); | ||
const extra = getComponent(instance, 'extra'); | ||
const backIcon = | ||
getComponentFromProp(instance, 'backIcon') !== undefined ? ( | ||
getComponentFromProp(instance, 'backIcon') | ||
getComponent(instance, 'backIcon') !== undefined ? ( | ||
getComponent(instance, 'backIcon') | ||
) : ( | ||
<ArrowLeftOutlined /> | ||
); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. const onBack = instance.$listeners.back; |
||
const onBack = instance.$listeners.back; | ||
const onBack = instance.$attrs.onBack; | ||
const headingPrefixCls = `${prefixCls}-heading`; | ||
if (title || subTitle || tags || extra) { | ||
const backIconDom = renderBack(instance, prefixCls, backIcon, onBack); | ||
|
@@ -94,15 +94,17 @@ const renderChildren = (h, prefixCls, children) => { | |
const PageHeader = { | ||
name: 'APageHeader', | ||
props: PageHeaderProps, | ||
inject: { | ||
configProvider: { default: () => ConfigConsumerProps }, | ||
setup() { | ||
return { | ||
configProvider: inject('configProvider', ConfigConsumerProps), | ||
}; | ||
}, | ||
render(h) { | ||
const { getPrefixCls, pageHeader } = this.configProvider; | ||
const props = getOptionProps(this); | ||
const { prefixCls: customizePrefixCls, breadcrumb } = props; | ||
const footer = getComponentFromProp(this, 'footer'); | ||
const children = this.$slots.default; | ||
const footer = getComponent(this, 'footer'); | ||
const children = this.$slots.default && this.$slots.default(); | ||
|
||
let ghost = true; | ||
|
||
|
@@ -138,9 +140,8 @@ const PageHeader = { | |
}; | ||
|
||
/* istanbul ignore next */ | ||
PageHeader.install = function(Vue) { | ||
Vue.use(Base); | ||
Vue.component(PageHeader.name, PageHeader); | ||
PageHeader.install = function(app) { | ||
app.component(PageHeader.name, PageHeader); | ||
}; | ||
|
||
export default PageHeader; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
不知道为啥报一个 breadcrumb 相关的错
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
./components/breadcrumb/Breadcrumb.jsx
Cannot read property 'includes' of undefined
一直报这个错 @tangjinzhou
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
因为有 <Xxx.Xxx /> 的使用方式 @Amour1688 插件不支持
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
插件 bug,本周发版修复