notice.vue 732 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <template>
  2. <view v-if="props.show" class="notice" :style="{'background-color': props.bgColor, 'color':props.color}">
  3. <text>{{props.text}}</text>
  4. </view>
  5. </template>
  6. <script setup>
  7. const props = defineProps({
  8. show: Boolean,
  9. text: String,
  10. bgColor: {
  11. type: String,
  12. default: '#219EFF'
  13. },
  14. color: {
  15. type: String,
  16. default: '#ffffff'
  17. },
  18. });
  19. </script>
  20. <style lang="scss" scoped>
  21. .notice {
  22. width: 100vw;
  23. height: 100rpx;
  24. line-height: 100rpx;
  25. position: fixed;
  26. top: -100rpx;
  27. text-align: center;
  28. z-index: 9999;
  29. transition: all 0.5s;
  30. animation: go 2s ease;
  31. }
  32. @keyframes go {
  33. 0% {
  34. top: -100rpx;
  35. }
  36. 30% {
  37. top: 0;
  38. }
  39. 70% {
  40. top: 0;
  41. }
  42. 100% {
  43. top: -100rpx;
  44. }
  45. }
  46. </style>