Skip to content

Instantly share code, notes, and snippets.

@vdegenne
Created September 27, 2019 16:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vdegenne/17ae2bc06c53bfed4a01b3c937a65439 to your computer and use it in GitHub Desktop.
Save vdegenne/17ae2bc06c53bfed4a01b3c937a65439 to your computer and use it in GitHub Desktop.
import { LitElement, html } from 'lit-element'
import '@material/mwc-dialog'
import '@material/mwc-button'
class OurApp extends LitElement {
render() {
return html`
<mwc-dialog title="Are you sure ?" open @closed=${this.onDialogClose}>
<div>are you sure to perform this action ?</div>
<mwc-button slot=secondaryAction dialogAction=no></mwc-button>
<mwc-button slot=primaryAction dialogAction=yes raised></mwc-button>
</mwc-dialog>
`
}
onDialogClose (e) {
if (e.detail.action === 'yes') {
alert('BOOM')
}
else if (e.detail.action === 'no') {
alert('nothing happens')
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment