feat(DropdownItem): add get-container prop (#4611)

This commit is contained in:
neverland
2019-09-27 19:37:29 +08:00
committed by GitHub
parent ffdb823117
commit 4e837ee558
6 changed files with 253 additions and 169 deletions
+28 -20
View File
@@ -2,12 +2,13 @@ import { createNamespace } from '../utils';
import Cell from '../cell';
import Icon from '../icon';
import Popup from '../popup';
import { PortalMixin } from '../mixins/portal';
import { ChildrenMixin } from '../mixins/relation';
const [createComponent, bem] = createNamespace('dropdown-item');
export default createComponent({
mixins: [ChildrenMixin('vanDropdownMenu')],
mixins: [PortalMixin({ ref: 'wrapper' }), ChildrenMixin('vanDropdownMenu')],
props: {
value: null,
@@ -106,26 +107,33 @@ export default createComponent({
}
return (
<div vShow={this.showWrapper} style={style} class={bem([direction])}>
<Popup
vModel={this.showPopup}
overlay={overlay}
class={bem('content')}
position={direction === 'down' ? 'top' : 'bottom'}
duration={this.transition ? duration : 0}
closeOnClickOverlay={closeOnClickOverlay}
overlayStyle={{ position: 'absolute' }}
onOpen={this.onOpen}
onClose={this.onClose}
onOpened={this.onOpened}
onClosed={() => {
this.showWrapper = false;
this.$emit('closed');
}}
<div>
<div
vShow={this.showWrapper}
ref="wrapper"
style={style}
class={bem([direction])}
>
{Options}
{this.slots('default')}
</Popup>
<Popup
vModel={this.showPopup}
overlay={overlay}
class={bem('content')}
position={direction === 'down' ? 'top' : 'bottom'}
duration={this.transition ? duration : 0}
closeOnClickOverlay={closeOnClickOverlay}
overlayStyle={{ position: 'absolute' }}
onOpen={this.onOpen}
onClose={this.onClose}
onOpened={this.onOpened}
onClosed={() => {
this.showWrapper = false;
this.$emit('closed');
}}
>
{Options}
{this.slots('default')}
</Popup>
</div>
</div>
);
}