Skip to content

Instantly share code, notes, and snippets.

@stuart-haas
Last active September 25, 2021 20:08
Show Gist options
  • Save stuart-haas/58aba4c2275c7c64b850508e8b89b146 to your computer and use it in GitHub Desktop.
Save stuart-haas/58aba4c2275c7c64b850508e8b89b146 to your computer and use it in GitHub Desktop.
Dialog Modal Default Layout
<template>
<div>
<button class="button button--confirm" @click="openDialog">Open Dialog</button>
<DialogModal />
</div>
</template>
<script>
export default {
methods: {
openDialog() {
this.$dialog.open({
message: 'Are you sure you want to do this?',
resolver: (async (result) => {
try {
const res = await result;
/* eslint-disable no-console */
console.log(res);
} catch (error) {
console.warn(error);
}
}),
});
}
}
};
</script>
<style lang="scss" scoped>
.button {
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
cursor: pointer;
}
</style>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment