list.vue 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <template>
  2. <view>
  3. <mescroll-body ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback" :down="downOption" :up="upOption">
  4. <view >
  5. <card :list="list"></card>
  6. </view>
  7. </mescroll-body>
  8. </view>
  9. </template>
  10. <script>
  11. import MescrollMixin from "@/components/mescroll-body/mescroll-mixins.js";
  12. import card from "@/components/feedback/feedback"
  13. export default {
  14. components:{
  15. card
  16. },
  17. mixins:[MescrollMixin],
  18. data() {
  19. return {
  20. list: [],
  21. downOption: {
  22. use: true,
  23. auto: false
  24. },
  25. upOption: {
  26. page: {
  27. page: 0,
  28. size: 10
  29. },
  30. noMoreSize: 5,
  31. empty: {
  32. tip: '暂无相关数据'
  33. }
  34. },
  35. }
  36. },
  37. methods: {
  38. /**
  39. * 下拉回调
  40. */
  41. downCallback(){
  42. setTimeout(()=>{
  43. this.mescroll.resetUpScroll()
  44. },1500)
  45. },
  46. /**
  47. * 上拉回调
  48. * @param {Object} mescroll
  49. */
  50. upCallback(mescroll) {
  51. let params={
  52. current:mescroll.num,
  53. size:mescroll.size
  54. }
  55. try{
  56. this.$api.userFeedBack.page(params).then(res=>{
  57. let data=res.data.records
  58. let length=data.length
  59. let total=res.data.total
  60. mescroll.endBySize(length, total);
  61. if(mescroll.num == 1) this.list = [];
  62. this.list=this.list.concat(data);
  63. })
  64. }catch(e){
  65. mescroll.endErr();
  66. }
  67. },
  68. }
  69. }
  70. </script>
  71. <style>
  72. </style>