share.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. <template>
  2. <div id="dialog_index">
  3. <div class="created_dialog">
  4. <div class="blurBox"></div>
  5. <div class="content">
  6. <div class="dialog_title">{{ title }}</div>
  7. <div class="dialog_link">
  8. <p>
  9. {{ shareLink }}
  10. </p>
  11. </div>
  12. <div class="created_btn">
  13. <div class="created_cancel" @click="closeCreated">取消</div>
  14. <div class="created_confirm" ref="copylink$" :data-clipboard-text="shareLink" @click="createdConfirm">复制分享</div>
  15. </div>
  16. </div>
  17. </div>
  18. </div>
  19. </template>
  20. <script setup>
  21. import { onMounted, watch, defineProps, defineEmits, ref, nextTick } from "vue";
  22. import ClipboardJS from 'clipboard'
  23. import { Dialog } from '@/global_components/'
  24. const emit = defineEmits(["closeDialog"]);
  25. const props = defineProps({
  26. title: {
  27. type: String,
  28. default: "邀请好友",
  29. },
  30. shareLink: {
  31. type: String,
  32. default: "",
  33. },
  34. });
  35. const copylink$ = ref(null)
  36. const closeCreated = () => {
  37. emit("closeDialog");
  38. };
  39. const createdConfirm = () => {
  40. emit("closeDialog");
  41. };
  42. onMounted(() => {
  43. nextTick(()=>{
  44. new ClipboardJS(copylink$.value).on('success', function (e) {
  45. e.clearSelection()
  46. Dialog.toast({ content: '链接复制成功', type: 'success' })
  47. })
  48. })
  49. })
  50. </script>
  51. <style scoped lang="scss">
  52. #dialog_index {
  53. width: 100vw;
  54. height: 100%;
  55. // background: rgba(0, 0, 0, 0.5);
  56. position: fixed;
  57. left: 0;
  58. top: 0;
  59. z-index: 100000;
  60. pointer-events: none;
  61. .created_dialog {
  62. width: 8.64rem;
  63. // min-height: 5rem;
  64. // background: #ffffff;
  65. border-radius: 8px;
  66. position: absolute;
  67. left: 50%;
  68. top: 50%;
  69. transform: translate(-50%, -50%);
  70. pointer-events: auto;
  71. border: 1px solid rgba(255, 255, 255, 0.1);
  72. border-radius: 4px;
  73. .blurBox {
  74. position: absolute;
  75. z-index: 1;
  76. top: 0;
  77. left: 0;
  78. width: 100%;
  79. height: 100%;
  80. background: rgba(0, 0, 0, 0.7);
  81. filter: blur(1px);
  82. }
  83. .content {
  84. position: relative;
  85. z-index: 2;
  86. top: 0;
  87. left: 0;
  88. width: 100%;
  89. height: 100%;
  90. }
  91. .dialog_title {
  92. width: 100%;
  93. height: 1.39rem;
  94. padding: 0 0.56rem;
  95. box-sizing: border-box;
  96. font-size: 0.39rem;
  97. color: #fff;
  98. line-height: 1.39rem;
  99. overflow: hidden;
  100. text-overflow: ellipsis;
  101. white-space: nowrap;
  102. border-bottom-style: solid;
  103. border-bottom-width: 1px;
  104. border-bottom-color: rgba(255, 255, 255, 0.1);
  105. }
  106. .dialog_link {
  107. width: 100%;
  108. font-size: 0.39rem;
  109. color: rgba(255, 255, 255, 0.5);
  110. padding: 0.53rem 0.56rem;
  111. box-sizing: border-box;
  112. text-align: justify;
  113. text-align: left;
  114. > p {
  115. background: rgba(0, 0, 0, 0.5);
  116. padding: 0.15rem 0.28rem;
  117. word-break: break-all;
  118. word-wrap: break-word;
  119. text-overflow: -o-ellipsis-lastline;
  120. overflow: hidden;
  121. text-overflow: ellipsis;
  122. display: -webkit-box;
  123. -webkit-line-clamp: 2;
  124. line-clamp: 2;
  125. -webkit-box-orient: vertical;
  126. line-height: 0.72rem;
  127. }
  128. }
  129. .created_btn {
  130. width: 100%;
  131. height: 1.36rem;
  132. border-top-style: solid;
  133. border-top-width: 1px;
  134. border-top-color: rgba(255, 255, 255, 0.1);
  135. box-sizing: border-box;
  136. display: flex;
  137. align-items: center;
  138. justify-content: center;
  139. > div {
  140. width: 50%;
  141. height: 1.36rem;
  142. text-align: center;
  143. line-height: 1.36rem;
  144. font-size: 0.39rem;
  145. box-sizing: border-box;
  146. &.created_cancel {
  147. color: #fff;
  148. border-right-style: solid;
  149. border-right-width: 1px;
  150. border-right-color: rgba(0, 0, 0, 0.05);
  151. }
  152. &.created_confirm {
  153. color: #ed5d18;
  154. }
  155. }
  156. }
  157. }
  158. }
  159. </style>