enterprise.vue 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <template>
  2. <view>
  3. <mescroll-body ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback" :down="downOption"
  4. :up="upOption">
  5. <card :list="list"></card>
  6. </mescroll-body>
  7. </view>
  8. </template>
  9. <script>
  10. import card from "./comps/card.vue"
  11. import MescrollMixin from "@/components/mescroll-body/mescroll-mixins.js";
  12. export default {
  13. mixins: [MescrollMixin], // 使用mixin
  14. components: {
  15. card
  16. },
  17. data() {
  18. return {
  19. }
  20. },
  21. methods: {
  22. upCallback(mescroll) {
  23. let params = {
  24. }
  25. try {
  26. this.$api.enterprise.page(params).then(res => {
  27. let data = res.data.records
  28. data.forEach(item => {
  29. item.tagColor = 'bg-' + this.ColorList[Math.floor(Math.random() * this
  30. .ColorList.length)]
  31. })
  32. let total = res.data.total
  33. mescroll.endBySize(data.length, total);
  34. if (mescroll.num == 1) this.list = []; //如果是第一页需手动制空列表
  35. this.list = this.list.concat(data); //追加新数据
  36. })
  37. } catch (e) {
  38. this.mescroll.endErr()
  39. }
  40. }
  41. }
  42. }
  43. </script>
  44. <style lang="scss">
  45. </style>