index.vue 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. <template>
  2. <view class="message-page">
  3. <view class="menus-box">
  4. <view class="menus-item" v-for="(item,index) in menus" :key="index" :class="{'clicked':current===item.id}"
  5. @tap="handleChangeMessageType(item)">
  6. <text>{{item.title}}</text>
  7. </view>
  8. </view>
  9. <view class="message-list">
  10. <message-card-vue v-for="(item,index) in list" :key="index" :message="item"></message-card-vue>
  11. </view>
  12. </view>
  13. </template>
  14. <script setup>
  15. import {
  16. ref,
  17. onMounted
  18. } from 'vue';
  19. import messageCardVue from './components/messageCard.vue';
  20. // 菜单切换
  21. const menus = [{
  22. title: "未读消息",
  23. id: "1"
  24. },
  25. {
  26. title: "已读消息",
  27. id: "2"
  28. }
  29. ]
  30. const current = ref("1")
  31. const handleChangeMessageType = (item) => {
  32. current.value = item.id
  33. }
  34. const list = [
  35. {
  36. id:1,
  37. name:"消息名称",
  38. time:"2021.1.21 16:03:02",
  39. remark:"李某某于2023.04.04 12:02:02 提交渠道水情信息李某某于2023.04.04 12:02:02 提交渠道水情信息李某某于2023.04.04 12:02:02 提交渠道水情信息"
  40. },
  41. {
  42. id:1,
  43. name:"消息名称",
  44. time:"2021.1.21 16:03:02",
  45. remark:"李某某于2023.04.04 12:02:02 提交渠道水情信息"
  46. }
  47. ]
  48. </script>
  49. <style lang="scss" scoped>
  50. .message-page {
  51. height: calc(100vh - var(--window-top) - var(--window-bottom) - 40rpx);
  52. background-color: $uni-user-page-bgc;
  53. padding: 20rpx;
  54. .menus-box {
  55. width: 100%;
  56. overflow-x: auto;
  57. display: flex;
  58. .menus-item {
  59. flex: 0 0 50%;
  60. height: 80rpx;
  61. display: flex;
  62. justify-content: center;
  63. text {
  64. font-family: Source Han Sans;
  65. font-size: 40rpx;
  66. font-weight: 700;
  67. letter-spacing: 0rpx;
  68. font-feature-settings: "kern" on;
  69. border-bottom: 6rpx solid transparent;
  70. box-sizing: border-box;
  71. color: $uni-text-color;
  72. white-space: nowrap;
  73. }
  74. }
  75. .clicked {
  76. text {
  77. color: $uni-user-selected;
  78. border-bottom: 6rpx solid $uni-user-selected;
  79. }
  80. }
  81. }
  82. .message-list{
  83. margin-top: 20rpx;
  84. }
  85. }
  86. </style>