dashboardMsgList.vue 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. <script>
  2. export default {
  3. data() {
  4. return {
  5. contentWidth: "60%",
  6. };
  7. },
  8. props: {
  9. data: Array,
  10. },
  11. mounted() {
  12. let width = this.$refs.dashboardMsgList.$el.clientWidth;
  13. this.contentWidth = width * 0.7 + "px";
  14. },
  15. methods: {},
  16. };
  17. </script>
  18. <template>
  19. <a-list
  20. class="dashboardMsgList"
  21. item-layout="horizontal"
  22. :data-source="data"
  23. :split="false"
  24. ref="dashboardMsgList"
  25. >
  26. <a-list-item slot="renderItem" slot-scope="item">
  27. <a-row style="width: 100%" justify="start">
  28. <div style="width: 100%">
  29. <span v-if="item.isRead" style="color: rgba(153,153,153,0.58);">【已阅】</span>
  30. <span v-else>【待阅】</span>
  31. <span class="msg-warn" v-if="item.type == 1" style="color: #2ea8e6"
  32. >①</span
  33. >
  34. <span
  35. class="msg-warn"
  36. v-else-if="item.type == 2"
  37. style="color: #39bae6"
  38. >②</span
  39. >
  40. <span
  41. class="msg-warn"
  42. v-else-if="item.type == 3"
  43. style="color: #7ed4e6"
  44. >③</span
  45. >
  46. <span class="msg-warn" v-else></span>
  47. <span :class="{isReadClass:item.isRead===true}" class="msg-content-span">{{ item.msg }}</span>
  48. </div>
  49. </a-row>
  50. </a-list-item>
  51. </a-list>
  52. </template>
  53. <style lang="less" scoped>
  54. .dashboardMsgList {
  55. .ant-list-item {
  56. padding: 0 !important;
  57. line-height: 30px;
  58. width: 100%;
  59. }
  60. .msg-read {
  61. display: inline-block;
  62. width: 120px !important;
  63. flex-direction: row;
  64. }
  65. .msg-type {
  66. display: inline-block;
  67. width: 20px;
  68. flex-direction: row;
  69. text-align: left;
  70. }
  71. .msg-warn {
  72. display: inline-block;
  73. width: 20px;
  74. text-align: left;
  75. }
  76. .msg-content-span {
  77. display: inline-block;
  78. width: 70%;
  79. vertical-align: top;
  80. overflow: hidden;
  81. text-overflow: ellipsis;
  82. white-space: nowrap;
  83. &.isReadClass{
  84. color: rgba(153,153,153,0.58);
  85. }
  86. }
  87. }
  88. </style>