rtWatchPart.vue 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. <template>
  2. <div class="rtWatchPart">
  3. <div class="title">
  4. <div :class="blink ? 'blink-text' : ''">{{ title }}</div>
  5. <div :class="expand ? 'triangle-up' : 'triangle-down' " @click="handleClick"></div>
  6. </div>
  7. <div :class="expand ? 'content' : 'content-hide'" >
  8. <slot></slot>
  9. </div>
  10. </div>
  11. </template>
  12. <script>
  13. export default {
  14. name: 'rtWatchPart',
  15. props: {
  16. blink: {
  17. type: Boolean,
  18. default: false
  19. },
  20. title: {
  21. type: String,
  22. default() {
  23. return '标题'
  24. }
  25. },
  26. expand: {
  27. type: Boolean,
  28. default: false
  29. }
  30. },
  31. data() {
  32. return {
  33. }
  34. },
  35. methods: {
  36. handleClick() {
  37. this.expand = !this.expand
  38. }
  39. }
  40. }
  41. </script>
  42. <style scoped>
  43. @keyframes blink {
  44. 0%, 100% {
  45. /* opacity: 1; 不透明 */
  46. color: rgb(200 191 238);
  47. }
  48. 50% {
  49. /* opacity: 0; 完全透明 */
  50. color: rgb(255, 0, 0)
  51. }
  52. }
  53. /* 应用动画 */
  54. .blink-text {
  55. animation: blink 1s linear infinite; /* 动画名称,持续时间,速度曲线,迭代次数 */
  56. }
  57. .rtWatchPart {
  58. background: rgba(0,0,0,0.8);
  59. box-shadow: rgba(0,0,0, 0.8) 0 5px 5px;
  60. border: 1px solid rgba(0,0,0,1);
  61. .title {
  62. width: 100%;
  63. height: 30px;
  64. border-bottom: 1px solid rgba(118, 127, 238, 1);
  65. color: rgb(200 191 238);
  66. padding-top: 5px;
  67. padding-left: 10px;
  68. display: flex;
  69. flex-direction: row;
  70. justify-content: space-between;
  71. text-shadow: -1px -1px 0 #444, 1px -1px 0 #444, -1px 1px 0 #444, 1px 1px 0 #444;
  72. }
  73. .content {
  74. height: fit-content;
  75. /* height: calc(100% - 30px); */
  76. }
  77. .content-hide {
  78. display: none;
  79. }
  80. .triangle-up {
  81. width: 0;
  82. height: 0;
  83. border-left: 8px solid transparent; /* 左边的边 */
  84. border-right: 8px solid transparent; /* 右边的边 */
  85. border-bottom: 16px solid rgb(200 191 238); /* 底边,设置为黑色或其他颜色 */
  86. cursor: pointer;
  87. margin-right: 5px;
  88. }
  89. .triangle-down {
  90. width: 0;
  91. height: 0;
  92. border-left: 8px solid transparent; /* 左边的边 */
  93. border-right: 8px solid transparent; /* 右边的边 */
  94. border-top: 16px solid rgb(200 191 238); /* 顶边,设置为黑色或其他颜色 */
  95. cursor: pointer;
  96. margin-right: 5px;
  97. }
  98. }
  99. </style>