diff --git a/packages/zent/src/popover/Content.tsx b/packages/zent/src/popover/Content.tsx index 819cf4e018..d3f1efd447 100644 --- a/packages/zent/src/popover/Content.tsx +++ b/packages/zent/src/popover/Content.tsx @@ -57,7 +57,7 @@ export default class PopoverContent extends Component< constructor(props) { super(props); this.state = { - position: null, + position: (invisiblePlacement as any)(props.prefix), }; // 标记 content 的位置是否 ready @@ -186,10 +186,6 @@ export default class PopoverContent extends Component< } = this.props; const { position } = this.state; - if (!position) { - return null; - } - const cls = cx(className, `${prefix}-popover`, id, position.toString()); return ( diff --git a/packages/zent/src/portal/LayeredPortal.tsx b/packages/zent/src/portal/LayeredPortal.tsx index d1f3c60e67..de0a5fa730 100644 --- a/packages/zent/src/portal/LayeredPortal.tsx +++ b/packages/zent/src/portal/LayeredPortal.tsx @@ -243,12 +243,14 @@ export class LayeredPortal extends Component< render() { // Render the portal content to container node or parent node - const { visible, withEscToClose, append } = this.props; + const { visible, withEscToClose, append, children } = this.props; const { layer } = this.state; return visible ? ( <> - + + {children} + {withEscToClose && ( )} diff --git a/packages/zent/src/select/Popup.tsx b/packages/zent/src/select/Popup.tsx index 9971120b67..743843a7b6 100644 --- a/packages/zent/src/select/Popup.tsx +++ b/packages/zent/src/select/Popup.tsx @@ -62,7 +62,7 @@ class Popup extends Component { this.focused = false; } - componentWillMount() { + componentDidMount() { const { autoWidth, popover } = this.props; if (autoWidth) { this.setState({ @@ -71,9 +71,6 @@ class Popup extends Component { }, }); } - } - - componentDidMount() { this.popup.addEventListener('mousewheel', this.handleScroll); }