rank.vue 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <template>
  2. <view class="free-container dir-left-wrap">
  3. <episode
  4. v-for="(episode,index) in episodes"
  5. :key="index"
  6. :episode="episode"
  7. :rank="episode.rank"
  8. :custom-style="{
  9. marginRight: ((index+1) % 3 !== 0 ? '20rpx' :''),
  10. }"
  11. />
  12. </view>
  13. </template>
  14. <script>
  15. import Episode from '../../components/Episode/index'
  16. export default {
  17. name: 'Free',
  18. components: { Episode },
  19. data() {
  20. return {
  21. limit: 12,
  22. page: 1,
  23. isMore: true,
  24. episodes: []
  25. }
  26. },
  27. computed: {},
  28. methods: {
  29. getRank() {
  30. this.loading = true
  31. this.$api.episode.rank({ limit: this.limit, page: this.page }).then(res => {
  32. this.loading = false
  33. if (res.data.length) {
  34. this.episodes = this.episodes.concat(res.data)
  35. } else {
  36. this.isMore = false
  37. }
  38. })
  39. }
  40. },
  41. onLoad() {
  42. this.getRank()
  43. },
  44. onReachBottom(e) {
  45. if (!this.isMore) return
  46. // this.page += 1
  47. // this.getRank()
  48. }
  49. }
  50. </script>
  51. <style lang="scss" scoped>
  52. .free-container {
  53. padding: 20rpx;
  54. }
  55. </style>