Toast.vue 695 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <template>
  2. <div class="toast-wrap">
  3. <div class="toast">
  4. {{ title }}
  5. </div>
  6. </div>
  7. </template>
  8. <script lang="ts">
  9. export default {
  10. name: 'Toast',
  11. props: {
  12. title: {
  13. type: String,
  14. default: '我是toast'
  15. }
  16. },
  17. setup() {
  18. return {}
  19. }
  20. }
  21. </script>
  22. <style lang="less" scoped>
  23. .toast-wrap {
  24. z-index: 1000;
  25. width: 100%;
  26. height: 100%;
  27. position: fixed;
  28. top: 0;
  29. left: 0;
  30. display: flex;
  31. justify-content: center;
  32. align-items: center;
  33. background: rgba(0,0,0,0.5);
  34. }
  35. .toast {
  36. max-width: 6rem;
  37. color: #ffffff;
  38. font-size: 14px;
  39. text-align: center;
  40. border-radius: 5px;
  41. padding: 10px;
  42. background: rgba(0, 0, 0, 0.8);
  43. }
  44. </style>