List.vue 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <template>
  2. <div>
  3. <div class="detail-main__comments">
  4. <div class="detail-comments">
  5. <div class="detail-comments__wrapper">
  6. <div
  7. class="detail-comments__title"
  8. :data-comments="commentsList.total_comments"
  9. >
  10. Комментарии
  11. </div>
  12. <ul class="detail-comments__list">
  13. <ArticleCommentsItem
  14. v-for="commentsItem in commentsList.comments"
  15. :key="commentsItem.id"
  16. :commentsItem="commentsItem"
  17. @commentResponse="commentResponseData"
  18. />
  19. </ul>
  20. </div>
  21. </div>
  22. </div>
  23. </div>
  24. </template>
  25. <script>
  26. import { mapGetters } from "vuex"
  27. export default {
  28. props: {
  29. pull_id: {
  30. type: String,
  31. },
  32. newCommentsList: {
  33. type: Object,
  34. },
  35. },
  36. watch: {
  37. newCommentsList(val) {
  38. this.commentsList = val;
  39. },
  40. },
  41. data() {
  42. return {
  43. script: ``,
  44. commentsList: []
  45. }
  46. },
  47. mounted() {
  48. this.$axios.get("/comments/pull_" + this.pull_id + (0 ? 'page_' + 0 : ''))
  49. .then((Comments) => {
  50. this.commentsList = Comments.data.data;
  51. });
  52. },
  53. methods: {
  54. commentResponseData(data) {
  55. this.$emit('commentResponse', data);
  56. }
  57. }
  58. }
  59. </script>
  60. <style>
  61. </style>