EditDialog.vue 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <template>
  2. <el-dialog
  3. v-model="visible"
  4. :close-on-click-modal="false"
  5. :close-on-press-escape="false"
  6. fullscreen
  7. align-center
  8. append-to-body
  9. :show-close="false"
  10. >
  11. <check
  12. @onClose="onClose"
  13. :addRowData="addRowData"
  14. @confirm="onConfirm"
  15. :id="id"
  16. />
  17. </el-dialog>
  18. </template>
  19. <script setup lang="ts">
  20. import { ref, defineProps, defineEmits , watch } from 'vue'
  21. import check from '@/views/Photography/check'
  22. const props = defineProps({
  23. id:{
  24. type: Number||String,
  25. default: 0
  26. },
  27. modelValue: {
  28. type: Boolean,
  29. default: false
  30. },
  31. addRowData:{
  32. type: Object,
  33. default: () => {
  34. return { }
  35. }
  36. }
  37. })
  38. const emit = defineEmits<{
  39. (e: 'update:modelValue', value: boolean): void
  40. (e: 'confirm'): void
  41. }>()
  42. const visible = ref(props.modelValue)
  43. // 监听visible变化
  44. watch(() => visible.value, (newVal) => {
  45. console.log(visible.value)
  46. emit('update:modelValue', newVal)
  47. })
  48. const onClose = ()=>{
  49. console.log('onClose')
  50. visible.value = false;
  51. }
  52. const onConfirm = ()=>{
  53. console.log('onConfirm')
  54. emit('confirm')
  55. onClose()
  56. }
  57. </script>
  58. <style lang="scss" scoped>
  59. </style>