Dialog.vue 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <script setup lang="ts">
  2. import { computed } from "vue";
  3. import { useI18n } from "vue-i18n";
  4. const { t } = useI18n();
  5. const showDialog = computed(() => props.dialog);
  6. const props = defineProps({
  7. msg: {
  8. type: String,
  9. default: "",
  10. },
  11. dialog: {
  12. type: Boolean,
  13. default: false,
  14. },
  15. state: {
  16. type: String,
  17. },
  18. icon: {
  19. type: String,
  20. default: "info"
  21. },
  22. qrcode: {
  23. type: Boolean,
  24. default: false,
  25. }
  26. });
  27. const emit = defineEmits(["close"]);
  28. function close() {
  29. emit("close", false);
  30. }
  31. </script>
  32. <template>
  33. <v-dialog
  34. :value="showDialog"
  35. v-model="showDialog"
  36. width="400"
  37. @click:outside="close()"
  38. >
  39. <v-card>
  40. <v-card-text>
  41. <section class="d-flex flex-column align-center">
  42. <v-icon style="font-size: 70px" :icon="icon" :color="state" />
  43. <!-- <p class="mt-3">{{ msg }}</p> -->
  44. <p v-html="msg" class="mt-3 text-center"></p>
  45. </section>
  46. </v-card-text>
  47. <v-card-actions class="d-flex justify-space-evenly">
  48. <v-btn @click="close()" v-show="!qrcode || (state === 'error' && qrcode)">{{ t("close") }}</v-btn>
  49. <router-link v-show="(state === 'success' || state === 'error') && qrcode" to="/main/dashboard">返回使用者頁面</router-link>
  50. </v-card-actions>
  51. </v-card>
  52. </v-dialog>
  53. </template>