操作记录

描述:

技术杖element组件封装的

  1. <template>
  2. <div :class="onOff ? 'content contentLeft' : 'content'">
  3. <div
  4. :class="onOff ? 'record' : 'packUp'"
  5. class="btn"
  6. @click="
  7. () => {
  8. onOff = !onOff;
  9. }
  10. "
  11. >
  12. {{ onOff ? "操作记录" : "收起" }}
  13. </div>
  14. <div class="body">
  15. <h3>操作记录</h3>
  16. <el-timeline :reverse="reverse">
  17. <el-timeline-item
  18. v-for="(activity, index) in activities"
  19. :key="index"
  20. :timestamp="activity.timestamp"
  21. >
  22. {{ activity.content }}
  23. </el-timeline-item>
  24. </el-timeline>
  25. </div>
  26. </div>
  27. </template>
  28. <script>
  29. export default {
  30. props: {
  31. activities: {
  32. type: Array,
  33. default: function () {
  34. return [
  35. {
  36. content: "测试数据1",
  37. timestamp: "2018-04-15",
  38. },
  39. {
  40. content: "测试数据2",
  41. timestamp: "2018-04-13",
  42. },
  43. {
  44. content: "测试数据3",
  45. timestamp: "2018-04-11",
  46. },
  47. ];
  48. },
  49. },
  50. reverse: {
  51. type: Boolean,
  52. default: false,
  53. },
  54. },
  55. data() {
  56. return {
  57. // 开关
  58. onOff: true,
  59. };
  60. },
  61. };
  62. </script>
  63. <style scoped lang="scss">
  64. .content {
  65. display: flex;
  66. position: fixed;
  67. top: 20%;
  68. right: -20px;
  69. z-index: 333;
  70. transition: right 1s;
  71. .record {
  72. font-size: 14px;
  73. box-sizing: border-box;
  74. height: 80px;
  75. width: 50px;
  76. line-height: 50px;
  77. color: #fff;
  78. background-color: #1bb6ec;
  79. border-radius: 6px 0 0 6px;
  80. cursor: pointer;
  81. -ms-writing-mode: tb-rl;
  82. text-align: center;
  83. writing-mode: tb-rl;
  84. &::selection {
  85. text-shadow: none;
  86. }
  87. }
  88. .packUp {
  89. font-size: 14px;
  90. box-sizing: border-box;
  91. height: 80px;
  92. width: 50px;
  93. border: 1px solid #ccc;
  94. line-height: 50px;
  95. background-color: #fff;
  96. border-radius: 6px 0 0 6px;
  97. cursor: pointer;
  98. writing-mode: tb-rl;
  99. -ms-writing-mode: tb-rl;
  100. text-align: center;
  101. &::selection {
  102. text-shadow: none;
  103. }
  104. }
  105. .body {
  106. width: 260px;
  107. height: 360px;
  108. padding: 10px;
  109. box-sizing: border-box;
  110. border: 1px solid #ccc;
  111. background-color: #fff;
  112. overflow: auto;
  113. h3 {
  114. text-align: center;
  115. margin-bottom: 20px;
  116. }
  117. }
  118. }
  119. .contentLeft {
  120. right: -280px;
  121. transition: right 1s;
  122. }
  123. </style>

image.pngimage.png