mirror of
https://gitee.com/baidu/amis.git
synced 2024-11-30 11:07:52 +08:00
Panel affixFooter支持 always 配置
This commit is contained in:
parent
63459f3039
commit
7863cd7594
@ -17,7 +17,7 @@ export interface PanelProps extends RendererProps {
|
||||
actionsClassName?: string;
|
||||
bodyClassName?: string;
|
||||
children?: React.ReactNode | ((props: any) => JSX.Element);
|
||||
affixFooter?: boolean;
|
||||
affixFooter?: boolean | 'always';
|
||||
}
|
||||
|
||||
export default class Panel extends React.Component<PanelProps> {
|
||||
@ -61,11 +61,19 @@ export default class Panel extends React.Component<PanelProps> {
|
||||
|
||||
const affixDom = this.affixDom.current;
|
||||
const footerDom = this.footerDom.current;
|
||||
const clip = footerDom.getBoundingClientRect();
|
||||
const clientHeight = window.innerHeight;
|
||||
const affixed = clip.top > clientHeight;
|
||||
|
||||
let affixed = false;
|
||||
footerDom.offsetWidth && (affixDom.style.cssText = `width: ${footerDom.offsetWidth}px;`);
|
||||
|
||||
if (this.props.affixFooter === 'always') {
|
||||
affixed = true;
|
||||
footerDom.classList.add('hidden');
|
||||
} else {
|
||||
const clip = footerDom.getBoundingClientRect();
|
||||
const clientHeight = window.innerHeight;
|
||||
affixed = clip.top > clientHeight;
|
||||
}
|
||||
|
||||
|
||||
affixed ? affixDom.classList.add('in') : affixDom.classList.remove('in');
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user