index.vue 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. <template>
  2. <div
  3. v-if="show"
  4. class="useTip-wrap"
  5. >
  6. <ModalCpt
  7. :title="title"
  8. :mask-closable="maskClosable"
  9. @close="handleCancel()"
  10. >
  11. {{ msg }}
  12. <template #footer>
  13. <div class="footer">
  14. <div
  15. v-if="!hiddenCancel"
  16. class="btn return"
  17. @click="handleCancel()"
  18. >
  19. 取消
  20. </div>
  21. <div
  22. :class="{ btn: 1, next: 1, hiddenCancel }"
  23. @click="handleOk()"
  24. >
  25. 确认
  26. </div>
  27. </div>
  28. </template>
  29. </ModalCpt>
  30. </div>
  31. </template>
  32. <script lang="ts">
  33. import { defineComponent, ref } from 'vue';
  34. import ModalCpt from '@/components/Modal/index.vue';
  35. export default defineComponent({
  36. components: { ModalCpt },
  37. emits: ['ok', 'cancel'],
  38. setup() {
  39. const title = ref('提示');
  40. const msg = ref('');
  41. const show = ref(false);
  42. const hiddenCancel = ref(false);
  43. const hiddenClose = ref(false);
  44. const maskClosable = ref(true);
  45. function handleCancel(cb?) {
  46. cb?.();
  47. }
  48. function handleOk(cb?) {
  49. cb?.();
  50. }
  51. return {
  52. title,
  53. msg,
  54. show,
  55. hiddenCancel,
  56. hiddenClose,
  57. maskClosable,
  58. handleCancel,
  59. handleOk,
  60. };
  61. },
  62. });
  63. </script>
  64. <style lang="scss" scoped>
  65. .useTip-wrap {
  66. .footer {
  67. display: flex;
  68. align-items: center;
  69. justify-content: space-between;
  70. .btn {
  71. box-sizing: border-box;
  72. width: 130px;
  73. height: 44px;
  74. border-radius: 100px;
  75. text-align: center;
  76. line-height: 44px;
  77. cursor: pointer;
  78. user-select: none;
  79. &.return {
  80. border: 1px solid rgba(153, 153, 153, 0.3);
  81. background: #ffffff;
  82. color: #666;
  83. font-size: 14px;
  84. }
  85. &.next {
  86. background-color: #fbab7e;
  87. background-image: linear-gradient(62deg, #fbab7e 0%, #f7ce68 100%);
  88. color: white;
  89. font-weight: 700;
  90. font-size: 16px;
  91. &.hiddenCancel {
  92. width: 100%;
  93. }
  94. }
  95. }
  96. }
  97. }
  98. </style>