FamilyFeed.vue 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. <template>
  2. <view class="family-feed">
  3. <view class="feed-header" v-if="showHeader">
  4. <text class="feed-icon">📢</text>
  5. <text class="feed-title">家庭动态</text>
  6. </view>
  7. <scroll-view scroll-x class="feed-scroll" scroll-with-animation :show-scrollbar="false">
  8. <view class="feed-list">
  9. <view class="feed-item" v-for="(item, idx) in feedItems" :key="idx">
  10. <text class="feed-msg">{{ item.text }}</text>
  11. <text class="feed-time">{{ item.time }}</text>
  12. </view>
  13. </view>
  14. </scroll-view>
  15. </view>
  16. </template>
  17. <script>
  18. export default {
  19. name: 'FamilyFeed',
  20. props: {
  21. items: {
  22. type: Array,
  23. default: function() { return [] }
  24. },
  25. showHeader: {
  26. type: Boolean,
  27. default: true
  28. }
  29. },
  30. data: function() {
  31. return {
  32. scrollLeft: 0
  33. }
  34. },
  35. computed: {
  36. feedItems: function() {
  37. return this.items.length > 0 ? this.items : [
  38. { text: '暂无动态,先做几个任务吧', time: '' }
  39. ]
  40. }
  41. }
  42. }
  43. </script>
  44. <style>
  45. .family-feed {
  46. margin: 12rpx 30rpx 0;
  47. background: #fff;
  48. border-radius: 16rpx;
  49. padding: 12rpx 16rpx 14rpx;
  50. box-shadow: 0 2rpx 8rpx rgba(0,0,0,0.04);
  51. }
  52. .feed-header {
  53. display: flex;
  54. flex-direction: row;
  55. align-items: center;
  56. gap: 6rpx;
  57. margin-bottom: 8rpx;
  58. }
  59. .feed-icon {
  60. font-size: 22rpx;
  61. }
  62. .feed-title {
  63. font-size: 22rpx;
  64. font-weight: bold;
  65. color: #333;
  66. }
  67. .feed-scroll {
  68. width: 100%;
  69. white-space: nowrap;
  70. }
  71. .feed-list {
  72. display: inline-flex;
  73. flex-direction: row;
  74. gap: 12rpx;
  75. padding: 2rpx 0;
  76. }
  77. .feed-item {
  78. display: flex;
  79. flex-direction: row;
  80. align-items: center;
  81. flex-shrink: 0;
  82. background: #F8FAFC;
  83. border-radius: 20rpx;
  84. padding: 6rpx 14rpx;
  85. white-space: nowrap;
  86. }
  87. .feed-msg {
  88. font-size: 20rpx;
  89. color: #333;
  90. margin-right: 4rpx;
  91. white-space: nowrap;
  92. overflow: hidden;
  93. text-overflow: ellipsis;
  94. }
  95. .feed-time {
  96. font-size: 16rpx;
  97. color: #999;
  98. flex-shrink: 0;
  99. }
  100. </style>