comment.uvue 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <template>
  2. <view class="flex">
  3. <view class="flex flex-row items-center mb-3">
  4. <cl-text>买家评论 78</cl-text>
  5. <cl-icon name="arrow-right-s-line" :size="16" :pt="{ className: 'ml-auto' }"></cl-icon>
  6. </view>
  7. <view class="flex flex-col">
  8. <view class="flex flex-row my-3" v-for="item in list" :key="item.id">
  9. <cl-avatar :size="36" rounded :src="item.avatar"></cl-avatar>
  10. <view class="flex-1 ml-4">
  11. <view class="flex flex-row items-center justify-between">
  12. <cl-text :size="12">{{ item.name }}</cl-text>
  13. <cl-text color="info" :size="10">{{ item.time }}</cl-text>
  14. </view>
  15. <cl-text ellipsis :lines="2" :pt="{ className: 'mt-1' }">{{
  16. item.content
  17. }}</cl-text>
  18. </view>
  19. <view class="ml-3 relative">
  20. <cl-image
  21. :height="50"
  22. :width="50"
  23. :pt="{
  24. inner: {
  25. className: '!rounded-lg'
  26. }
  27. }"
  28. src="https://unix.cool-js.com/images/demo/bg1.png"
  29. />
  30. <view class="bg-black/60 rounded-full px-1 absolute top-8 right-1">
  31. <cl-text :size="10" color="white">+3</cl-text>
  32. </view>
  33. </view>
  34. </view>
  35. </view>
  36. </view>
  37. </template>
  38. <script setup lang="ts">
  39. import { ref } from "vue";
  40. type Comment = {
  41. id: number;
  42. avatar: string;
  43. name: string;
  44. content: string;
  45. time: string;
  46. };
  47. const list = ref<Comment[]>([
  48. {
  49. id: 1,
  50. avatar: "https://unix.cool-js.com/images/demo/avatar-1.jpg",
  51. name: "李明",
  52. content: "导游讲解很专业,风景绝美,是一次难忘的旅行体验!",
  53. time: "几分钟前"
  54. },
  55. {
  56. id: 2,
  57. avatar: "https://unix.cool-js.com/images/demo/avatar-2.jpg",
  58. name: "小芳",
  59. content: "酒店干净卫生,位置也很方便,强烈推荐给大家!",
  60. time: "1小时前"
  61. },
  62. {
  63. id: 3,
  64. avatar: "https://unix.cool-js.com/images/demo/avatar-3.jpg",
  65. name: "王科",
  66. content: "行程安排合理,吃住都很满意,导游态度超级好。",
  67. time: "5天前"
  68. }
  69. ]);
  70. </script>