confirm.vue 874 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <script setup>
  2. import { ref } from 'vue'
  3. defineProps({
  4. title: String,
  5. text: String,
  6. cancel: Function,
  7. sure: Function
  8. })
  9. defineOptions({ name: 'ct-confirm' })
  10. const dialog = ref(true)
  11. // const show = () => {
  12. // dialog.value = true
  13. // }
  14. // defineExpose({ show })
  15. </script>
  16. <template>
  17. <v-app>
  18. <v-dialog
  19. v-model="dialog"
  20. max-width="400"
  21. persistent
  22. >
  23. <v-card
  24. :text="text"
  25. :title="title"
  26. >
  27. <template #prepend>
  28. <v-icon color="warning">mdi-alert-circle-outline</v-icon>
  29. </template>
  30. <template v-slot:actions>
  31. <v-spacer></v-spacer>
  32. <v-btn @click="cancel">
  33. 取消
  34. </v-btn>
  35. <v-btn color="success" @click="sure">
  36. 确认
  37. </v-btn>
  38. </template>
  39. </v-card>
  40. </v-dialog>
  41. </v-app>
  42. </template>