toast.vue 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. <template>
  2. <div class="content" v-show="show">
  3. <div class="mark">
  4. <div class="background"></div>
  5. <img :src="icon" alt="">
  6. <span>{{ txt }}</span>
  7. </div>
  8. </div>
  9. </template>
  10. <script setup>
  11. import { defineProps, watch, reactive } from "vue";
  12. let props = defineProps({
  13. txt: {
  14. type: String,
  15. default: ''
  16. },
  17. icon: {
  18. type: String,
  19. default: require('@/assets/svg/icon-while-yes.svg')
  20. },
  21. show: {
  22. type: Boolean,
  23. default: false
  24. },
  25. })
  26. </script>
  27. <style lang="scss" scoped>
  28. .content {
  29. position: fixed;
  30. width: 375px;
  31. height: 500px;
  32. text-align: center;
  33. display: flex;
  34. justify-content: center;
  35. top: 0;
  36. .mark {
  37. height: 39px;
  38. top: 50%;
  39. width: fit-content;
  40. color: #FFFFFF;
  41. border-radius: 44px;
  42. overflow: hidden;
  43. position: relative;
  44. display: flex;
  45. align-items: center;
  46. padding: 0 13px;
  47. img {
  48. z-index: 2;
  49. width: 15px;
  50. height: 15px;
  51. margin-right: 6px;
  52. }
  53. span {
  54. z-index: 2;
  55. font-weight: 600;
  56. font-size: 14px;
  57. color: #fff;
  58. }
  59. .background {
  60. z-index: 1;
  61. width: 100%;
  62. left: 0;
  63. top: 0;
  64. height: 100%;
  65. position: absolute;
  66. background: rgba(0, 0, 0, 0.8);
  67. }
  68. }
  69. }
  70. </style>