add open watcher

This commit is contained in:
Cory LaViska
2021-03-30 08:33:08 -04:00
parent 560441bea3
commit 28c0121a69

View File

@@ -2,7 +2,7 @@ import { LitElement, html, unsafeCSS } from 'lit';
import { customElement, property, query, state } from 'lit/decorators';
import { classMap } from 'lit-html/directives/class-map';
import { ifDefined } from 'lit-html/directives/if-defined';
import { event, EventEmitter } from '../../internal/decorators';
import { event, EventEmitter, watch } from '../../internal/decorators';
import styles from 'sass:./drawer.scss';
import { lockBodyScrolling, unlockBodyScrolling } from '../../internal/scroll';
import { hasSlot } from '../../internal/slot';
@@ -191,6 +191,11 @@ export default class SlDrawer extends LitElement {
}
}
@watch('open')
handleOpenChange() {
this.open ? this.show() : this.hide();
}
handleOverlayClick() {
const slOverlayDismiss = this.slOverlayDismiss.emit();
if (!slOverlayDismiss.defaultPrevented) {