| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- <template>
- <view>
- <mescroll-body ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback" :down="downOption"
- :up="upOption">
- <card :list="list"></card>
- </mescroll-body>
- </view>
- </template>
- <script>
- import card from "./comps/card.vue"
- import MescrollMixin from "@/components/mescroll-body/mescroll-mixins.js";
- export default {
- mixins: [MescrollMixin], // 使用mixin
- components: {
- card
- },
- data() {
- return {
- }
- },
- methods: {
- upCallback(mescroll) {
- let params = {
- }
- try {
- this.$api.enterprise.page(params).then(res => {
- let data = res.data.records
- data.forEach(item => {
- item.tagColor = 'bg-' + this.ColorList[Math.floor(Math.random() * this
- .ColorList.length)]
- })
- let total = res.data.total
- mescroll.endBySize(data.length, total);
- if (mescroll.num == 1) this.list = []; //如果是第一页需手动制空列表
- this.list = this.list.concat(data); //追加新数据
- })
- } catch (e) {
- this.mescroll.endErr()
- }
- }
- }
- }
- </script>
- <style lang="scss">
- </style>
|