洛阳学员端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

65 lines
1.3 KiB

8 months ago
8 months ago
  1. <template>
  2. <view class="comments">
  3. <view class="navBox">
  4. <view class="nav" v-for="(item,index) in navList" :key="index" @click="changeNav(item)" :class="{active: currentNav==item.id}">{{ item.text }}</view>
  5. </view>
  6. <view class="card" v-for="(item,index) in list">
  7. <commentItem :item="item"/>
  8. </view>
  9. </view>
  10. </template>
  11. <script>
  12. // import commentItem from './commentItem'
  13. export default {
  14. // components: { commentItem },
  15. props: ['list'],
  16. data() {
  17. return {
  18. // 0,全部,1,有图,2最新,3有视频
  19. navList: [
  20. {text: '全部', id: 0},
  21. {text: '最新', id: 2},
  22. {text: '有图', id: 1},
  23. {text: '有视频', id: 3},
  24. ],
  25. currentNav: 0,
  26. }
  27. },
  28. methods: {
  29. changeNav(item) {
  30. this.currentNav = item.id
  31. this.$emit('changeNav', item.id)
  32. }
  33. }
  34. }
  35. </script>
  36. <style lang="scss" scoped>
  37. .comments {
  38. width: 100%;
  39. padding: 0 28rpx;
  40. .navBox {
  41. padding: 32rpx 0 24rpx 0;
  42. display: flex;
  43. z-index: 9;
  44. .nav {
  45. padding: 6rpx 24rpx;
  46. height: 50rpx;
  47. background: #F6F7FA;
  48. border-radius: 8rpx;
  49. font-size: 28rpx;
  50. color: #999;
  51. margin-right: 20rpx;
  52. text-align: center;
  53. &.active {
  54. color: #fff;
  55. background: $themC;
  56. }
  57. }
  58. }
  59. .card {
  60. width: 100%;
  61. }
  62. }
  63. </style>