actionList.vue 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <template>
  2. <view class="content">
  3. <view class="" style="height: 1rpx;"></view>
  4. <empty v-if="loaded === true && list.length === 0"></empty>
  5. <view class="action-wrap" v-for="item in list" >
  6. <image src="" mode=""></image>
  7. </view>
  8. <uni-load-more :status="loadingType"></uni-load-more>
  9. </view>
  10. </template>
  11. <script>
  12. import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
  13. import empty from '@/components/empty';
  14. import {getActionList} from '@/api/index.js'
  15. export default {
  16. components: {
  17. uniLoadMore,
  18. empty
  19. },
  20. data() {
  21. return {
  22. page: 1,
  23. limit: 10,
  24. loadingType: 'more',
  25. loaded: false,
  26. list: []
  27. }
  28. },
  29. onLoad(opt) {
  30. },
  31. onShow() {
  32. // this.getList()
  33. },
  34. onReachBottom() {
  35. },
  36. onReady() {
  37. },
  38. methods: {
  39. getList() {
  40. let that = this
  41. if(that.loadingType == 'loading' || that.loadingType == 'noMore') {
  42. return
  43. }
  44. getActionList({
  45. page: that.page,
  46. limit: that.limit
  47. }).then(res => {
  48. let list = res.data.list
  49. that.list = that.list.concat(list)
  50. that.page++
  51. if(list.length == that.limit) {
  52. that.loadingType = 'more'
  53. }else {
  54. that.loadingType = 'noMore'
  55. }
  56. that.loaded = true
  57. })
  58. }
  59. }
  60. }
  61. </script>
  62. <style lang="scss">
  63. .action-wrap {
  64. width: 704rpx;
  65. height: 330rpx;
  66. margin:20rpx auto;
  67. image {
  68. width: 704rpx;
  69. height: 330rpx;
  70. border-radius: 20rpx;
  71. }
  72. }
  73. </style>