CommentList.vue 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <template>
  2. <div class="comment-list">
  3. <div class="page-title" v-if="comments.length">评论</div>
  4. <div class="comment"
  5. v-for="comment in comments"
  6. :key="comment.id"
  7. @click="handleClick(comment)"
  8. >
  9. <div class="user">
  10. <div class="inline">
  11. <img :src="comment.image"
  12. class="avatar"
  13. mode="aspectFit">
  14. {{comment.title}}
  15. </div>
  16. <div class="right">
  17. {{comment.location||'未知地点'}}
  18. <span class="text-primary">
  19. --
  20. </span>
  21. {{comment.phone||'未知型号'}}
  22. </div>
  23. </div>
  24. <div class="content">
  25. {{comment.comment}}
  26. </div>
  27. </div>
  28. </div>
  29. </template>
  30. <script>
  31. export default {
  32. props: ['comments', 'type'],
  33. methods: {
  34. handleClick (comment) {
  35. if (this.type === 'user') {
  36. wx.navigateTo({
  37. url: '/pages/detail/main?id=' + comment.bookid
  38. })
  39. }
  40. }
  41. }
  42. }
  43. </script>
  44. <style lang="scss">
  45. .comment-list{
  46. background:#eee;
  47. font-size:14px;
  48. .comment{
  49. background: white;
  50. margin-bottom:10px;
  51. padding:5px 20px;
  52. .content{
  53. margin:10px 0;
  54. }
  55. .user{
  56. .inline{
  57. display:inline;
  58. .avatar{
  59. width:20px;
  60. height:20px;
  61. border-radius: 50%;
  62. }
  63. }
  64. }
  65. }
  66. }
  67. </style>