answerQueren.vue 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <template>
  2. <view>
  3. <uni-popup ref="popupRef" type="dialog" :animation="false" :is-mask-click="false"
  4. mask-background-color="rgba(0, 0, 0, 0.4);">
  5. <uni-popup-dialog mode="input"
  6. class="phone-ksxz-dialog"
  7. title="提示"
  8. :duration="2000"
  9. :before-close="true"
  10. :showClose="true"
  11. @close="handleClose"
  12. @confirm="handleConfirm">
  13. <text>
  14. 您已经回答了{{data.answercartsCount}}题(共{{data.answercartsTotal}}题),确认交卷?
  15. </text>
  16. </uni-popup-dialog>
  17. </uni-popup>
  18. </view>
  19. </template>
  20. <script setup>
  21. import {
  22. ref,reactive
  23. } from "vue";
  24. const popupRef = ref(null)
  25. const data = reactive({
  26. answercartsCount: '',
  27. answercartsTotal: '',
  28. })
  29. const emits = defineEmits(['confirm', 'cancel'])
  30. function showDialog(options) {
  31. data.answercartsCount = options.answercartsCount;
  32. data.answercartsTotal = options.answercartsTotal;
  33. popupRef.value.open()
  34. }
  35. function handleClose() {
  36. emits('cancel');
  37. popupRef.value.close()
  38. }
  39. function handleConfirm() {
  40. emits('confirm', data);
  41. popupRef.value.close()
  42. }
  43. defineExpose({
  44. showDialog
  45. })
  46. </script>
  47. <style>
  48. </style>