AlertDialog.vue 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <template>
  2. <div class="dialog">
  3. <div class="center">
  4. <div class="title">{{title}}</div>
  5. <div class="text">{{text}}</div>
  6. <div class="p-3 text-center">
  7. <button @click="closeDialog()" class="btn bt-sm btn-dark mb-1">OK</button>
  8. </div>
  9. </div>
  10. </div>
  11. </template>
  12. <script>
  13. import { defineComponent } from 'vue';
  14. import {closeDialog} from 'vue3-promise-dialog'
  15. export default defineComponent({
  16. props: {
  17. text: String,
  18. title: String
  19. },
  20. setup() {
  21. function returnValue() {
  22. return true;
  23. }
  24. return {
  25. returnValue,
  26. closeDialog
  27. };
  28. },
  29. });
  30. </script>
  31. <style scoped>
  32. .dialog {
  33. position: fixed;
  34. top: 0;
  35. left: 0;
  36. bottom: 0;
  37. right: 0;
  38. background-color: rgba(0, 0, 0, 0.3);
  39. z-index: 1000;
  40. }
  41. .center {
  42. position: fixed;
  43. top: 50%;
  44. left: 50%;
  45. transform: translate(-50%, -50%);
  46. background-color: white;
  47. width: 30%;
  48. min-width: 400px;
  49. box-shadow: 5px 5px 5px #6f6f6f;
  50. }
  51. .title {
  52. background-color: #FFC300;
  53. padding: 0.5em;
  54. font-size: 1.5em;
  55. }
  56. .text {
  57. padding: 0.5em;
  58. padding-left: 1.5em;
  59. font-size: 1.2em;
  60. font-weight: 600;
  61. }
  62. .btn {
  63. margin: 10px;
  64. min-width: 100px;
  65. }
  66. </style>