FundingRateReminder.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. <template>
  2. <Teleport to="body">
  3. <transition name="fade">
  4. <div v-if="visible" class="modal-mask" @click="close">
  5. <div class="modal-container" @click.stop>
  6. <div class="modal-title">资金费率</div>
  7. <div class="modal-text">
  8. 费率为正,做多仓位支付做空仓位
  9. 费率为负,做空仓位支付做多仓位
  10. </div>
  11. <button class="main-btn" @click="close">
  12. 我知道了
  13. </button>
  14. </div>
  15. </div>
  16. </transition>
  17. </Teleport>
  18. </template>
  19. <script setup>
  20. import { defineProps, defineEmits } from 'vue';
  21. defineProps({
  22. visible: Boolean
  23. });
  24. const emit = defineEmits(['update:visible']);
  25. const close = () => {
  26. emit('update:visible', false);
  27. };
  28. </script>
  29. <style scoped>
  30. /* --- 布局与遮罩 --- */
  31. .modal-mask {
  32. position: fixed;
  33. top: 0;
  34. left: 0;
  35. width: 100vw;
  36. height: 100vh;
  37. background: rgba(0, 0, 0, 0.6); /* 深色遮罩 */
  38. display: flex;
  39. align-items: center; /* 垂直居中 */
  40. justify-content: center; /* 水平居中 */
  41. z-index: 2000;
  42. }
  43. /* --- 弹窗卡片 --- */
  44. .modal-container {
  45. width: 310px; /* 稍微宽一点,适配文字换行 */
  46. background: #fff;
  47. border-radius: 16px; /* 大圆角 */
  48. padding: 24px 24px;
  49. box-sizing: border-box;
  50. text-align: center;
  51. box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
  52. }
  53. /* --- 标题 --- */
  54. .modal-title {
  55. font-size: 18px;
  56. font-weight: 600;
  57. color: #111;
  58. margin-bottom: 16px;
  59. }
  60. /* --- 正文 --- */
  61. .modal-text {
  62. font-size: 15px;
  63. color: #555; /* 稍微柔和的深灰色 */
  64. line-height: 1.6; /* 增加行高,易读 */
  65. text-align: justify; /* 两端对齐,像报纸一样整齐 */
  66. max-width: 226px;
  67. margin: 24px auto;
  68. }
  69. /* --- 红色按钮 --- */
  70. .main-btn {
  71. width: 100%;
  72. height: 46px;
  73. background: #DE3545; /* 截图里的标准红 */
  74. color: #fff;
  75. font-size: 16px;
  76. font-weight: 500;
  77. border: none;
  78. border-radius: 23px; /* 高度的一半,形成胶囊形状 */
  79. cursor: pointer;
  80. }
  81. .main-btn:active {
  82. opacity: 0.8; /* 点击反馈 */
  83. }
  84. /* --- 动画效果: 缩放弹入 --- */
  85. .fade-enter-active, .fade-leave-active {
  86. transition: opacity 0.2s ease;
  87. }
  88. .fade-enter-active .modal-container {
  89. animation: pop-in 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28); /* 弹性动画 */
  90. }
  91. .fade-leave-active .modal-container {
  92. animation: pop-in 0.3s reverse;
  93. }
  94. .fade-enter-from, .fade-leave-to {
  95. opacity: 0;
  96. }
  97. @keyframes pop-in {
  98. 0% { transform: scale(0.8); opacity: 0; }
  99. 100% { transform: scale(1); opacity: 1; }
  100. }
  101. </style>