perf(Popover): using popper lite

This commit is contained in:
chenjiahan 2020-11-18 15:19:10 +08:00 committed by neverland
parent 7b51efa572
commit ae29b09520

View File

@ -1,4 +1,5 @@
import { createPopper } from '@popperjs/core'; import { createPopper } from '@popperjs/core/lib/popper-lite';
import offsetModifier from '@popperjs/core/lib/modifiers/offset';
import { createNamespace } from '../utils'; import { createNamespace } from '../utils';
import { BORDER_BOTTOM } from '../utils/constant'; import { BORDER_BOTTOM } from '../utils/constant';
@ -88,7 +89,7 @@ export default createComponent({
}, },
}, },
{ {
name: 'offset', ...offsetModifier,
options: { options: {
offset: this.offset, offset: this.offset,
}, },
@ -110,12 +111,14 @@ export default createComponent({
}, },
renderAction(action) { renderAction(action) {
const { icon, text, disabled, className } = action;
return ( return (
<div class={bem('action')} onClick={this.onClickAction}> <div
{action.icon && ( class={[bem('action', { disabled }), className]}
<Icon name={action.icon} class={bem('action-icon')} /> onClick={this.onClickAction}
)} >
<div class={[bem('action-text'), BORDER_BOTTOM]}>{action.text}</div> {icon && <Icon name={icon} class={bem('action-icon')} />}
<div class={[bem('action-text'), BORDER_BOTTOM]}>{text}</div>
</div> </div>
); );
}, },