DeletePageDialog.vue 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <template>
  2. <div class="delete-page-popup" v-if="show">
  3. <Dialog :show="show" :dialogName="dialogName" :close="false">
  4. <!-- content -->
  5. <Warning />
  6. <p>{{ $t('documentEditor.deleteConfirmText') }}{{ locale === 'en' ? ` ${pageStr}?` : '' }}</p>
  7. <!-- footer -->
  8. <template #footer>
  9. <div class="rect-button white" @click="closeDialog">{{ $t('cancel') }}</div>
  10. <div class="rect-button blue" @click="handleDelete">{{ $t('documentEditor.delete') }}</div>
  11. </template>
  12. </Dialog>
  13. </div>
  14. </template>
  15. <script setup>
  16. import { computed } from 'vue'
  17. import { useViewerStore } from '@/stores/modules/viewer'
  18. import { useI18n } from 'vue-i18n'
  19. const { locale } = useI18n()
  20. const props = defineProps(['selectedPageList'])
  21. const emits = defineEmits(['deletePage'])
  22. const useViewer = useViewerStore()
  23. const dialogName = 'deletePageDialog'
  24. const show = computed(() => useViewer.isElementOpen(dialogName))
  25. const pageStr = computed(() => {
  26. return props.selectedPageList.sort((a, b) => a - b).map(item => item + 1).join(', ')
  27. })
  28. const closeDialog = () => {
  29. useViewer.closeElement(dialogName)
  30. }
  31. const handleDelete = async () => {
  32. emits('deletePage')
  33. closeDialog()
  34. }
  35. </script>
  36. <style lang="scss">
  37. .delete-page-popup {
  38. .dialog-container {
  39. width: 381px;
  40. main {
  41. margin-top: 0;
  42. margin-bottom: 20px;
  43. display: flex;
  44. align-items: center;
  45. svg {
  46. margin-right: 8px;
  47. min-width: 20px;
  48. width: 20px;
  49. height: 20px;
  50. }
  51. p {
  52. font-size: 16px;
  53. line-height: 24px;
  54. }
  55. }
  56. }
  57. }
  58. </style>