list.vue 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <template>
  2. <view><!-- :url="'/pages/message/detail?id=' + item.messageid" -->
  3. <navigator v-for="item in list" :key="item.messageid" class="item" @tap="read(item)" url="#">
  4. <view class="title u-line-1">{{ item.title || ' --' }}</view>
  5. <view class="content u-line-3">{{ item.message || ' --' }}</view>
  6. <view class="time">{{ item.readdate || ' --' }}</view>
  7. <view class="unread" v-if="item.isread == 0" />
  8. </navigator>
  9. </view>
  10. </template>
  11. <script>
  12. export default {
  13. name: "List",
  14. props: {
  15. list: Array,
  16. onReadMsg: Function
  17. },
  18. methods: {
  19. read(item) {
  20. if (item.isread == 0) this.$emit("onReadMsg", item)
  21. }
  22. },
  23. }
  24. </script>
  25. <style lang="scss" scoped>
  26. .item {
  27. position: relative;
  28. width: 355px;
  29. margin: 10px auto 0;
  30. background-color: #fff;
  31. border-radius: 4px;
  32. box-sizing: border-box;
  33. padding: 10px;
  34. .title {
  35. font-size: 14px;
  36. margin-bottom: 6px;
  37. }
  38. .content {
  39. font-size: 12px;
  40. margin-bottom: 6px;
  41. }
  42. .time {
  43. font-size: 10px;
  44. color: #666;
  45. }
  46. .unread {
  47. position: absolute;
  48. top: 3px;
  49. right: 3px;
  50. width: 8px;
  51. height: 8px;
  52. background: #FF3B30;
  53. border-radius: 50%;
  54. }
  55. }
  56. </style>