Last active
September 25, 2021 20:08
-
-
Save stuart-haas/58aba4c2275c7c64b850508e8b89b146 to your computer and use it in GitHub Desktop.
Dialog Modal Default Layout
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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